$npx -y skills add SafeAI-Lab-X/ClawKeeper --skill feishu-docFeishu document read/write operations. Activate when user mentions Feishu docs, cloud docs, or docx links.
| 1 | # Feishu Document Tool |
| 2 | |
| 3 | Single tool `feishu_doc` with action parameter for all document operations, including table creation for Docx. |
| 4 | |
| 5 | ## Token Extraction |
| 6 | |
| 7 | From URL `https://xxx.feishu.cn/docx/ABC123def` → `doc_token` = `ABC123def` |
| 8 | |
| 9 | ## Actions |
| 10 | |
| 11 | ### Read Document |
| 12 | |
| 13 | ```json |
| 14 | { "action": "read", "doc_token": "ABC123def" } |
| 15 | ``` |
| 16 | |
| 17 | Returns: title, plain text content, block statistics. Check `hint` field - if present, structured content (tables, images) exists that requires `list_blocks`. |
| 18 | |
| 19 | ### Write Document (Replace All) |
| 20 | |
| 21 | ```json |
| 22 | { "action": "write", "doc_token": "ABC123def", "content": "# Title\n\nMarkdown content..." } |
| 23 | ``` |
| 24 | |
| 25 | Replaces entire document with markdown content. Supports: headings, lists, code blocks, quotes, links, images (`` auto-uploaded), bold/italic/strikethrough. |
| 26 | |
| 27 | **Limitation:** Markdown tables are NOT supported. |
| 28 | |
| 29 | ### Append Content |
| 30 | |
| 31 | ```json |
| 32 | { "action": "append", "doc_token": "ABC123def", "content": "Additional content" } |
| 33 | ``` |
| 34 | |
| 35 | Appends markdown to end of document. |
| 36 | |
| 37 | ### Create Document |
| 38 | |
| 39 | ```json |
| 40 | { "action": "create", "title": "New Document", "owner_open_id": "ou_xxx" } |
| 41 | ``` |
| 42 | |
| 43 | With folder: |
| 44 | |
| 45 | ```json |
| 46 | { |
| 47 | "action": "create", |
| 48 | "title": "New Document", |
| 49 | "folder_token": "fldcnXXX", |
| 50 | "owner_open_id": "ou_xxx" |
| 51 | } |
| 52 | ``` |
| 53 | |
| 54 | **Important:** Always pass `owner_open_id` with the requesting user's `open_id` (from inbound metadata `sender_id`) so the user automatically gets `full_access` permission on the created document. Without this, only the bot app has access. |
| 55 | |
| 56 | ### List Blocks |
| 57 | |
| 58 | ```json |
| 59 | { "action": "list_blocks", "doc_token": "ABC123def" } |
| 60 | ``` |
| 61 | |
| 62 | Returns full block data including tables, images. Use this to read structured content. |
| 63 | |
| 64 | ### Get Single Block |
| 65 | |
| 66 | ```json |
| 67 | { "action": "get_block", "doc_token": "ABC123def", "block_id": "doxcnXXX" } |
| 68 | ``` |
| 69 | |
| 70 | ### Update Block Text |
| 71 | |
| 72 | ```json |
| 73 | { |
| 74 | "action": "update_block", |
| 75 | "doc_token": "ABC123def", |
| 76 | "block_id": "doxcnXXX", |
| 77 | "content": "New text" |
| 78 | } |
| 79 | ``` |
| 80 | |
| 81 | ### Delete Block |
| 82 | |
| 83 | ```json |
| 84 | { "action": "delete_block", "doc_token": "ABC123def", "block_id": "doxcnXXX" } |
| 85 | ``` |
| 86 | |
| 87 | ### Create Table (Docx Table Block) |
| 88 | |
| 89 | ```json |
| 90 | { |
| 91 | "action": "create_table", |
| 92 | "doc_token": "ABC123def", |
| 93 | "row_size": 2, |
| 94 | "column_size": 2, |
| 95 | "column_width": [200, 200] |
| 96 | } |
| 97 | ``` |
| 98 | |
| 99 | Optional: `parent_block_id` to insert under a specific block. |
| 100 | |
| 101 | ### Write Table Cells |
| 102 | |
| 103 | ```json |
| 104 | { |
| 105 | "action": "write_table_cells", |
| 106 | "doc_token": "ABC123def", |
| 107 | "table_block_id": "doxcnTABLE", |
| 108 | "values": [ |
| 109 | ["A1", "B1"], |
| 110 | ["A2", "B2"] |
| 111 | ] |
| 112 | } |
| 113 | ``` |
| 114 | |
| 115 | ### Create Table With Values (One-step) |
| 116 | |
| 117 | ```json |
| 118 | { |
| 119 | "action": "create_table_with_values", |
| 120 | "doc_token": "ABC123def", |
| 121 | "row_size": 2, |
| 122 | "column_size": 2, |
| 123 | "column_width": [200, 200], |
| 124 | "values": [ |
| 125 | ["A1", "B1"], |
| 126 | ["A2", "B2"] |
| 127 | ] |
| 128 | } |
| 129 | ``` |
| 130 | |
| 131 | Optional: `parent_block_id` to insert under a specific block. |
| 132 | |
| 133 | ### Upload Image to Docx (from URL or local file) |
| 134 | |
| 135 | ```json |
| 136 | { |
| 137 | "action": "upload_image", |
| 138 | "doc_token": "ABC123def", |
| 139 | "url": "https://example.com/image.png" |
| 140 | } |
| 141 | ``` |
| 142 | |
| 143 | Or local path with position control: |
| 144 | |
| 145 | ```json |
| 146 | { |
| 147 | "action": "upload_image", |
| 148 | "doc_token": "ABC123def", |
| 149 | "file_path": "/tmp/image.png", |
| 150 | "parent_block_id": "doxcnParent", |
| 151 | "index": 5 |
| 152 | } |
| 153 | ``` |
| 154 | |
| 155 | Optional `index` (0-based) inserts the image at a specific position among sibling blocks. Omit to append at end. |
| 156 | |
| 157 | **Note:** Image display size is determined by the uploaded image's pixel dimensions. For small images (e.g. 480x270 GIFs), scale to 800px+ width before uploading to ensure proper display. |
| 158 | |
| 159 | ### Upload File Attachment to Docx (from URL or local file) |
| 160 | |
| 161 | ```json |
| 162 | { |
| 163 | "action": "upload_file", |
| 164 | "doc_token": "ABC123def", |
| 165 | "url": "https://example.com/report.pdf" |
| 166 | } |
| 167 | ``` |
| 168 | |
| 169 | Or local path: |
| 170 | |
| 171 | ```json |
| 172 | { |
| 173 | "action": "upload_file", |
| 174 | "doc_token": "ABC123def", |
| 175 | "file_path": "/tmp/report.pdf", |
| 176 | "filename": "Q1-report.pdf" |
| 177 | } |
| 178 | ``` |
| 179 | |
| 180 | Rules: |
| 181 | |
| 182 | - exactly one of `url` / `file_path` |
| 183 | - optional `filename` override |
| 184 | - optional `parent_block_id` |
| 185 | |
| 186 | ## Reading Workflow |
| 187 | |
| 188 | 1. Start with `action: "read"` - get plain text + statistics |
| 189 | 2. Check `block_types` in response for Table, Image, Code, etc. |
| 190 | 3. If structured content exists, use `action: "list_blocks"` for full data |
| 191 | |
| 192 | ## Configuration |
| 193 | |
| 194 | ```yaml |
| 195 | channels: |
| 196 | feishu: |
| 197 | tools: |
| 198 | doc: true # default: true |
| 199 | ``` |
| 200 | |
| 201 | **Note:** `feishu_wiki` depends on this tool - wiki page content is read/written via `feishu_doc`. |
| 202 | |
| 203 | ## Permissions |
| 204 | |
| 205 | Required: `docx:document`, `docx:document:readonly`, `docx:document.block:convert`, `drive:drive` |