{"kind":"Skill","metadata":{"namespace":"community","name":"feishu-doc","version":"0.1.0"},"spec":{"description":"|","files":{"SKILL.md":"---\nname: feishu-doc\ndescription: |\n  Feishu document read/write operations. Activate when user mentions Feishu docs, cloud docs, or docx links.\n---\n\n# Feishu Document Tool\n\nSingle tool `feishu_doc` with action parameter for all document operations, including table creation for Docx.\n\n## Token Extraction\n\nFrom URL `https://xxx.feishu.cn/docx/ABC123def` → `doc_token` = `ABC123def`\n\n## Actions\n\n### Read Document\n\n```json\n{ \"action\": \"read\", \"doc_token\": \"ABC123def\" }\n```\n\nReturns: title, plain text content, block statistics. Check `hint` field - if present, structured content (tables, images) exists that requires `list_blocks`.\n\n### Write Document (Replace All)\n\n```json\n{ \"action\": \"write\", \"doc_token\": \"ABC123def\", \"content\": \"# Title\\n\\nMarkdown content...\" }\n```\n\nReplaces entire document with markdown content. Supports: headings, lists, code blocks, quotes, links, images (`![](url)` auto-uploaded), bold/italic/strikethrough.\n\n**Limitation:** Markdown tables are NOT supported.\n\n### Append Content\n\n```json\n{ \"action\": \"append\", \"doc_token\": \"ABC123def\", \"content\": \"Additional content\" }\n```\n\nAppends markdown to end of document.\n\n### Create Document\n\n```json\n{ \"action\": \"create\", \"title\": \"New Document\", \"owner_open_id\": \"ou_xxx\" }\n```\n\nWith folder:\n\n```json\n{\n  \"action\": \"create\",\n  \"title\": \"New Document\",\n  \"folder_token\": \"fldcnXXX\",\n  \"owner_open_id\": \"ou_xxx\"\n}\n```\n\n**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.\n\n### List Blocks\n\n```json\n{ \"action\": \"list_blocks\", \"doc_token\": \"ABC123def\" }\n```\n\nReturns full block data including tables, images. Use this to read structured content.\n\n### Get Single Block\n\n```json\n{ \"action\": \"get_block\", \"doc_token\": \"ABC123def\", \"block_id\": \"doxcnXXX\" }\n```\n\n### Update Block Text\n\n```json\n{\n  \"action\": \"update_block\",\n  \"doc_token\": \"ABC123def\",\n  \"block_id\": \"doxcnXXX\",\n  \"content\": \"New text\"\n}\n```\n\n### Delete Block\n\n```json\n{ \"action\": \"delete_block\", \"doc_token\": \"ABC123def\", \"block_id\": \"doxcnXXX\" }\n```\n\n### Create Table (Docx Table Block)\n\n```json\n{\n  \"action\": \"create_table\",\n  \"doc_token\": \"ABC123def\",\n  \"row_size\": 2,\n  \"column_size\": 2,\n  \"column_width\": [200, 200]\n}\n```\n\nOptional: `parent_block_id` to insert under a specific block.\n\n### Write Table Cells\n\n```json\n{\n  \"action\": \"write_table_cells\",\n  \"doc_token\": \"ABC123def\",\n  \"table_block_id\": \"doxcnTABLE\",\n  \"values\": [\n    [\"A1\", \"B1\"],\n    [\"A2\", \"B2\"]\n  ]\n}\n```\n\n### Create Table With Values (One-step)\n\n```json\n{\n  \"action\": \"create_table_with_values\",\n  \"doc_token\": \"ABC123def\",\n  \"row_size\": 2,\n  \"column_size\": 2,\n  \"column_width\": [200, 200],\n  \"values\": [\n    [\"A1\", \"B1\"],\n    [\"A2\", \"B2\"]\n  ]\n}\n```\n\nOptional: `parent_block_id` to insert under a specific block.\n\n### Upload Image to Docx (from URL or local file)\n\n```json\n{\n  \"action\": \"upload_image\",\n  \"doc_token\": \"ABC123def\",\n  \"url\": \"https://example.com/image.png\"\n}\n```\n\nOr local path with position control:\n\n```json\n{\n  \"action\": \"upload_image\",\n  \"doc_token\": \"ABC123def\",\n  \"file_path\": \"/tmp/image.png\",\n  \"parent_block_id\": \"doxcnParent\",\n  \"index\": 5\n}\n```\n\nOptional `index` (0-based) inserts the image at a specific position among sibling blocks. Omit to append at end.\n\n**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.\n\n### Upload File Attachment to Docx (from URL or local file)\n\n```json\n{\n  \"action\": \"upload_file\",\n  \"doc_token\": \"ABC123def\",\n  \"url\": \"https://example.com/report.pdf\"\n}\n```\n\nOr local path:\n\n```json\n{\n  \"action\": \"upload_file\",\n  \"doc_token\": \"ABC123def\",\n  \"file_path\": \"/tmp/report.pdf\",\n  \"filename\": \"Q1-report.pdf\"\n}\n```\n\nRules:\n\n- exactly one of `url` / `file_path`\n- optional `filename` override\n- optional `parent_block_id`\n\n## Reading Workflow\n\n1. Start with `action: \"read\"` - get plain text + statistics\n2. Check `block_types` in response for Table, Image, Code, etc.\n3. If structured content exists, use `action: \"list_blocks\"` for full data\n\n## Configuration\n\n```yaml\nchannels:\n  feishu:\n    tools:\n      doc: true # default: true\n```\n\n**Note:** `feishu_wiki` depends on this tool - wiki page content is read/written via `feishu_doc`.\n\n## Permissions\n\nRequired: `docx:document`, `docx:document:readonly`, `docx:document.block:convert`, `drive:drive`\n","references/block-types.md":"# Feishu Block Types Reference\n\nComplete reference for Feishu document block types. Use with `feishu_doc_list_blocks`, `feishu_doc_update_block`, and `feishu_doc_delete_block`.\n\n## Block Type Table\n\n| block_type | Name            | Description                    | Editable |\n| ---------- | --------------- | ------------------------------ | -------- |\n| 1          | Page            | Document root (contains title) | No       |\n| 2          | Text            | Plain text paragraph           | Yes      |\n| 3          | Heading1        | H1 heading                     | Yes      |\n| 4          | Heading2        | H2 heading                     | Yes      |\n| 5          | Heading3        | H3 heading                     | Yes      |\n| 6          | Heading4        | H4 heading                     | Yes      |\n| 7          | Heading5        | H5 heading                     | Yes      |\n| 8          | Heading6        | H6 heading                     | Yes      |\n| 9          | Heading7        | H7 heading                     | Yes      |\n| 10         | Heading8        | H8 heading                     | Yes      |\n| 11         | Heading9        | H9 heading                     | Yes      |\n| 12         | Bullet          | Unordered list item            | Yes      |\n| 13         | Ordered         | Ordered list item              | Yes      |\n| 14         | Code            | Code block                     | Yes      |\n| 15         | Quote           | Blockquote                     | Yes      |\n| 16         | Equation        | LaTeX equation                 | Partial  |\n| 17         | Todo            | Checkbox / task item           | Yes      |\n| 18         | Bitable         | Multi-dimensional table        | No       |\n| 19         | Callout         | Highlight block                | Yes      |\n| 20         | ChatCard        | Chat card embed                | No       |\n| 21         | Diagram         | Diagram embed                  | No       |\n| 22         | Divider         | Horizontal rule                | No       |\n| 23         | File            | File attachment                | No       |\n| 24         | Grid            | Grid layout container          | No       |\n| 25         | GridColumn      | Grid column                    | No       |\n| 26         | Iframe          | Embedded iframe                | No       |\n| 27         | Image           | Image                          | Partial  |\n| 28         | ISV             | Third-party widget             | No       |\n| 29         | MindnoteBlock   | Mindmap embed                  | No       |\n| 30         | Sheet           | Spreadsheet embed              | No       |\n| 31         | Table           | Table                          | Partial  |\n| 32         | TableCell       | Table cell                     | Yes      |\n| 33         | View            | View embed                     | No       |\n| 34         | Undefined       | Unknown type                   | No       |\n| 35         | QuoteContainer  | Quote container                | No       |\n| 36         | Task            | Lark Tasks integration         | No       |\n| 37         | OKR             | OKR integration                | No       |\n| 38         | OKRObjective    | OKR objective                  | No       |\n| 39         | OKRKeyResult    | OKR key result                 | No       |\n| 40         | OKRProgress     | OKR progress                   | No       |\n| 41         | AddOns          | Add-ons block                  | No       |\n| 42         | JiraIssue       | Jira issue embed               | No       |\n| 43         | WikiCatalog     | Wiki catalog                   | No       |\n| 44         | Board           | Board embed                    | No       |\n| 45         | Agenda          | Agenda block                   | No       |\n| 46         | AgendaItem      | Agenda item                    | No       |\n| 47         | AgendaItemTitle | Agenda item title              | No       |\n| 48         | SyncedBlock     | Synced block reference         | No       |\n\n## Editing Guidelines\n\n### Text-based blocks (2-17, 19)\n\nUpdate text content using `feishu_doc_update_block`:\n\n```json\n{\n  \"doc_token\": \"ABC123\",\n  \"block_id\": \"block_xxx\",\n  \"content\": \"New text content\"\n}\n```\n\n### Image blocks (27)\n\nImages cannot be updated directly via `update_block`. Use `feishu_doc_write` or `feishu_doc_append` with markdown to add new images.\n\n### Table blocks (31)\n\n**Important:** Table blocks CANNOT be created via the `documentBlockChildren.create` API (error 1770029). This affects `feishu_doc_write` and `feishu_doc_append` - markdown tables will be skipped with a warning.\n\nTables can only be read (via `list_blocks`) and individual cells (type 32) can be updated, but new tables cannot be inserted programmatically via markdown.\n\n### Container blocks (24, 25, 35)\n\nGrid and QuoteContainer are layout containers. Edit their child blocks instead.\n\n## Common Patterns\n\n### Replace specific paragraph\n\n1. `feishu_doc_list_blocks` - find the block_id\n2. `feishu_doc_update_block` - update its content\n\n### Insert content at specific location\n\nCurrently, the API only supports appending to document end. For insertion at specific positions, consider:\n\n1. Read existing content\n2. Delete affected blocks\n3. Rewrite with new content in desired order\n\n### Delete multiple blocks\n\nBlocks must be deleted one at a time. Delete child blocks before parent containers.\n"},"import":{"commit_sha":"424c6d0a5f4665b803ad6768d08b0be7659deaf4","imported_at":"2026-05-18T20:13:36Z","license_text":"MIT License\n\nCopyright (c) 2025 Peter Steinberger\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","owner":"openclaw","repo":"openclaw/openclaw","source_url":"https://github.com/openclaw/openclaw/tree/424c6d0a5f4665b803ad6768d08b0be7659deaf4/extensions/feishu/skills/feishu-doc"}},"content_hash":[245,181,80,247,114,121,10,221,177,40,70,39,13,193,153,184,24,91,148,101,139,119,34,0,234,154,180,61,40,108,212,62],"trust_level":"unsigned","yanked":false}
