wecom_mcpis an MCP tool, and all operations are completed by calling this tool.
⚠️ Prerequisites: Before the first call to
wecom_mcp, you must follow thewecom-preflightskill to perform the prerequisite check to ensure the tool has been added to the allowlist.
Manage the creation, reading, and editing of WeCom documents. All interfaces support locating the document by either docid or url .
How to call
Call via the wecom_mcp tool, with the category being doc:
Use the wecom_mcp tool to call wecom_mcp call doc <tool_name> '<json_params>' to invoke the specified skill
Return format description
All interfaces return a JSON object containing the following common fields:
| Field | Type | Description |
|---|---|---|
errcode |
integer | Return code,0 indicates success, non- 0 indicates failure |
errmsg |
string | Error message, which is "ok" |
When errcode is not 0 , it indicates the interface call failed and can be retried once; if it still fails, display errcode and errmsg to the user.
get_doc_content
Get the full document content data, which can only be returned in Markdown format. Uses theasynchronous polling mechanism: The first call does not require passing task_id, and the interface returns task_id; if task_done is false, call again carrying that task_id until task_done is true, at which point the full content is returned.
- First call (without passing task_id): Use the
wecom_mcptool to callwecom_mcp call doc get_doc_content '{"docid": "DOCID", "type": 2}' - Polling (carrying the task_id returned last time): Use the
wecom_mcptool to callwecom_mcp call doc get_doc_content '{"docid": "DOCID", "type": 2, "task_id": "xxx"}' - Or via URL: Use the
wecom_mcptool to callwecom_mcp call doc get_doc_content '{"url": "https://doc.weixin.qq.com/doc/xxx", "type": 2}'
See API details。
create_doc
Create a new document (doc_type=3) or smart sheet (doc_type=10). On successful creation, returns url and docid.
- Use the
wecom_mcptool to callwecom_mcp call doc create_doc '{"doc_type": 3, "doc_name": "项目周报"}' - Use the
wecom_mcptool to callwecom_mcp call doc create_doc '{"doc_type": 10, "doc_name": "任务跟踪表"}'
Note: docid is only returned at creation time, so keep it safe. When creating a smart sheet, a sub-sheet is included by default; you can query its sheet_id via smartsheet_get_sheet .
See API details。
edit_doc_content
Overwrite the document body with Markdown content.content_type is fixed as 1(Markdown)。
Use the wecom_mcp tool to call wecom_mcp call doc edit_doc_content '{"docid": "DOCID", "content": "# 标题\n\n正文内容", "content_type": 1}'
See API details。
Typical workflow
- Read document → Use the
wecom_mcptool to callwecom_mcp call doc get_doc_content '{"docid": "DOCID", "type": 2}', iftask_doneis false, carrytask_idand continue polling - Create new document → Use the
wecom_mcptool to callwecom_mcp call doc create_doc '{"doc_type": 3, "doc_name": "文档名"}', and save the returned docid - Edit document → first use get_doc_content to understand the current content, then use edit_doc_content to overwrite