@wecom/wecom-openclaw-plugin 2026.6.23-beta.0 → 2026.7.2-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/wecom-doc/SKILL.md +63 -105
- package/skills/wecom-sheet/SKILL.md +131 -0
- package/skills/wecom-sheet/references/sheet-add-sub.md +54 -0
- package/skills/wecom-sheet/references/sheet-append-data.md +64 -0
- package/skills/wecom-sheet/references/sheet-delete-sub.md +38 -0
- package/skills/wecom-sheet/references/sheet-update-range-data.md +95 -0
- package/skills/wecom-smartpage/SKILL.md +119 -0
- package/skills/{wecom-doc → wecom-smartpage}/references/smartpage-create.md +6 -1
- package/skills/{wecom-doc → wecom-smartpage}/references/smartpage-export.md +19 -11
- package/skills/wecom-smartsheet/SKILL.md +107 -34
- package/skills/wecom-doc/references/create-doc.md +0 -56
- package/skills/wecom-doc/references/edit-doc-content.md +0 -68
- package/skills/wecom-doc/references/get-doc-content.md +0 -88
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: wecom-smartpage
|
|
3
|
+
description: 企业微信智能文档(原名智能主页,smartpage)管理技能。提供智能文档的创建(将本地 Markdown 文件发布为智能文档)与内容导出(异步导出为 Markdown)能力。适用场景:(1) 将一个或多个本地 Markdown 文件创建为智能文档 (2) 异步导出智能文档内容为 Markdown。支持通过 docid 或文档 URL 定位文档。当用户明确提到「智能文档」「智能主页」,或链接形如 `https://doc.weixin.qq.com/smartpage/xxx` 时触发该技能。注意:普通文档(`/doc/*`)请用 `wecom-doc`;在线表格(`/sheet/*`)请用 `wecom-sheet`;智能表格(`/smartsheet/*`)请用 `wecom-smartsheet`。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 企业微信智能文档管理
|
|
7
|
+
|
|
8
|
+
> `wecom_mcp` 是一个 MCP tool,所有操作通过调用该 tool 完成。
|
|
9
|
+
|
|
10
|
+
> ⚠️ **前置条件**:首次调用 `wecom_mcp` 前,必须按 `wecom-preflight` 技能执行前置条件检查,确保工具已加入白名单。
|
|
11
|
+
|
|
12
|
+
资源型技能,负责**智能文档**(原名智能主页,`/smartpage/*`)的创建与内容导出。
|
|
13
|
+
|
|
14
|
+
> ⚠️ **重要触发规则**:只有当用户明确提到「**智能文档**」或「**智能主页**」时,才使用本技能。其他所有涉及「文档」的场景(如"创建文档"、"写个文档"、"帮我建个文档"等),一律使用 `wecom-doc` 技能。
|
|
15
|
+
|
|
16
|
+
## 调用方式
|
|
17
|
+
|
|
18
|
+
通过 `wecom_mcp` tool 调用,品类名为 `doc`:
|
|
19
|
+
|
|
20
|
+
使用 `wecom_mcp` tool 调用 `wecom_mcp call doc <tool_name> '<json_params>'` 调用指定技能
|
|
21
|
+
|
|
22
|
+
## 返回格式说明
|
|
23
|
+
|
|
24
|
+
所有接口返回 JSON 对象,包含以下公共字段:
|
|
25
|
+
|
|
26
|
+
| 字段 | 类型 | 说明 |
|
|
27
|
+
|------|------|------|
|
|
28
|
+
| `errcode` | integer | 返回码,`0` 表示成功,非 `0` 表示失败 |
|
|
29
|
+
| `errmsg` | string | 错误信息,成功时为 `"ok"` |
|
|
30
|
+
|
|
31
|
+
当 `errcode` 不为 `0` 时,说明接口调用失败,可重试 1 次;若仍失败,将 `errcode` 和 `errmsg` 展示给用户。
|
|
32
|
+
|
|
33
|
+
### 特殊错误码
|
|
34
|
+
|
|
35
|
+
| errcode | errmsg | 含义 | 处理方式 |
|
|
36
|
+
|---------|--------|------|----------|
|
|
37
|
+
| `851002` | `incompatible doc type` | 文档品类与所调用的接口不匹配 | 确认目标 URL 为 `/smartpage/*`;若不是,请跳转到对应品类的 skill |
|
|
38
|
+
|
|
39
|
+
## 接口详述
|
|
40
|
+
|
|
41
|
+
### smartpage_create — 创建智能文档
|
|
42
|
+
|
|
43
|
+
创建智能文档(原名智能主页),支持传入标题和多个子页面。每个子页面可指定标题、内容类型和本地文件路径。创建成功返回 `docid` 和 `url`。
|
|
44
|
+
|
|
45
|
+
使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartpage_create '{"title": "项目概览", "pages": [{"page_title": "需求文档", "content_type": 1, "page_filepath": "/path/to/requirements.md"}]}'`
|
|
46
|
+
|
|
47
|
+
**参数**
|
|
48
|
+
|
|
49
|
+
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
|
50
|
+
|---|---|---|---|---|
|
|
51
|
+
| `title` | string | 否 | — | 智能文档标题 |
|
|
52
|
+
| `pages` | array | 是 | — | 子页面列表 |
|
|
53
|
+
| `pages[].page_title` | string | 否 | — | 子页面标题 |
|
|
54
|
+
| `pages[].content_type` | int | 否 | 1 | 内容类型:1-Markdown,0-Text(纯文本) |
|
|
55
|
+
| `pages[].page_filepath` | string | 否 | — | 子页面内容对应的本地文件路径 |
|
|
56
|
+
|
|
57
|
+
**注意事项**
|
|
58
|
+
|
|
59
|
+
- `content_type` **必须与文件实际内容匹配**:`.md` 文件或包含 Markdown 语法的内容必须传 `1`(Markdown),仅纯文本才传 `0`。绝大多数场景应传 `1`。
|
|
60
|
+
- `docid` 仅在创建时返回,需妥善保存。
|
|
61
|
+
- 每个子页面的 Markdown 文件大小不得超过 **10MB**,超过会导致创建失败;如文件过大,需先拆分为多个子页面再创建。
|
|
62
|
+
- 智能文档还支持背景块(`<card>`)、分栏(`<grid>`)等扩展语法,详见 [references/smartpage-create.md](references/smartpage-create.md)。
|
|
63
|
+
|
|
64
|
+
参见 [API 详情](references/smartpage-create.md)。
|
|
65
|
+
|
|
66
|
+
### smartpage_export_task — 提交导出任务
|
|
67
|
+
|
|
68
|
+
发起智能文档内容导出任务(异步)。传入 `docid`(或 `url`)和 `content_type`,返回 `task_id`。这是异步导出的第一步,需配合 `smartpage_get_export_result` 轮询获取导出结果。
|
|
69
|
+
|
|
70
|
+
- 通过 docid:使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartpage_export_task '{"docid": "DOCID", "content_type": 1}'`
|
|
71
|
+
- 或通过 URL:使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartpage_export_task '{"url": "https://doc.weixin.qq.com/smartpage/xxx", "content_type": 1}'`
|
|
72
|
+
|
|
73
|
+
**参数**
|
|
74
|
+
|
|
75
|
+
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
|
76
|
+
|---|---|---|---|---|
|
|
77
|
+
| `docid` | string | 与 `url` 二选一 | — | 智能文档的 docid |
|
|
78
|
+
| `url` | string | 与 `docid` 二选一 | — | 智能文档的访问链接 |
|
|
79
|
+
| `content_type` | int | 是 | — | 导出内容格式,目前仅支持 `1`(Markdown) |
|
|
80
|
+
|
|
81
|
+
参见 [API 详情](references/smartpage-export.md)。
|
|
82
|
+
|
|
83
|
+
### smartpage_get_export_result — 查询导出结果
|
|
84
|
+
|
|
85
|
+
查询智能文档导出任务进度。传入 `task_id` 进行轮询,当 `task_done` 为 `true` 时返回 `content_filepath`(导出内容的本地文件路径)。
|
|
86
|
+
|
|
87
|
+
使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartpage_get_export_result '{"task_id": "TASK_ID"}'`
|
|
88
|
+
|
|
89
|
+
**参数**
|
|
90
|
+
|
|
91
|
+
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
|
92
|
+
|---|---|---|---|---|
|
|
93
|
+
| `task_id` | string | 是 | — | 由 `smartpage_export_task` 返回的任务 ID |
|
|
94
|
+
|
|
95
|
+
**使用规则**
|
|
96
|
+
|
|
97
|
+
- 第一步获取 `task_id` 后,携带其调用第二步;若 `task_done` 为 `false` 则继续轮询,直到 `task_done` 为 `true`。
|
|
98
|
+
- 当 `task_done` 为 `true` 时,使用 Read 工具读取 `content_filepath` 指向的本地文件即可获取导出的 Markdown 内容。
|
|
99
|
+
|
|
100
|
+
参见 [API 详情](references/smartpage-export.md)。
|
|
101
|
+
|
|
102
|
+
## 典型工作流
|
|
103
|
+
|
|
104
|
+
### 创建智能文档
|
|
105
|
+
|
|
106
|
+
1. 准备本地 Markdown 文件(每个子页面对应一个 `.md` 文件,单个文件 ≤10MB)
|
|
107
|
+
2. **创建智能文档** → 使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartpage_create '{"title": "标题", "pages": [{"page_title": "子页面", "content_type": 1, "page_filepath": "/path/to/file.md"}]}'`,保存返回的 `docid`
|
|
108
|
+
|
|
109
|
+
### 导出智能文档内容(异步两步)
|
|
110
|
+
|
|
111
|
+
1. **发起导出任务** → 使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartpage_export_task '{"docid": "DOCID", "content_type": 1}'`,获取 `task_id`
|
|
112
|
+
2. **轮询导出结果** → 使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartpage_get_export_result '{"task_id": "TASK_ID"}'`,若 `task_done` 为 `false` 则继续轮询,直到 `task_done` 为 `true`
|
|
113
|
+
3. **读取本地文件** → 使用 Read 工具读取 `content_filepath` 指向的本地文件,获取 Markdown 内容
|
|
114
|
+
|
|
115
|
+
## 跨技能依赖
|
|
116
|
+
|
|
117
|
+
| 依赖技能 | 典型协作场景 | 数据流向 |
|
|
118
|
+
|---|---|---|
|
|
119
|
+
| `wecom-msg` | 用户要求把智能文档链接发给某人/某群 | 本 skill 创建后返回 `url` → `wecom-msg` 发送链接 |
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
创建智能文档(原智能主页)。支持传入多个子页面,每个子页面可指定标题、内容类型和本地文件路径。创建成功后返回文档访问链接和 docid。
|
|
4
4
|
|
|
5
|
+
## 调用
|
|
6
|
+
|
|
7
|
+
使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartpage_create '<JSON 参数>'`
|
|
8
|
+
|
|
5
9
|
## 技能定义
|
|
6
10
|
|
|
7
11
|
```json
|
|
@@ -117,9 +121,10 @@ width-ratio:子容器宽度占比,范围 0.1~1.0,所有的子容器宽度
|
|
|
117
121
|
"url": "https://doc.weixin.qq.com/smartpage/a1_xxxxxx"
|
|
118
122
|
}
|
|
119
123
|
```
|
|
124
|
+
|
|
120
125
|
## 注意事项
|
|
121
126
|
|
|
122
127
|
- `docid` 仅在创建时返回,后续无法再获取,务必保存
|
|
123
128
|
- `page_filepath` 指向本地文件,需确保文件存在且可读
|
|
124
129
|
- **`content_type` 必须与文件实际内容格式匹配**:`.md` 文件或包含 Markdown 语法的内容必须传 `1`,不要传 `0`
|
|
125
|
-
- 每个子页面的 Markdown 文件大小不得超过 **10MB**,超过会导致创建失败;如果文件过大,需先拆分为多个子页面
|
|
130
|
+
- 每个子页面的 Markdown 文件大小不得超过 **10MB**,超过会导致创建失败;如果文件过大,需先拆分为多个子页面
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
发起智能文档内容导出任务(异步)。传入 `docid` 或 `url` 和 `content_type`,返回 `task_id`。
|
|
10
10
|
|
|
11
|
+
### 调用
|
|
12
|
+
|
|
13
|
+
使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartpage_export_task '<JSON 参数>'`
|
|
14
|
+
|
|
11
15
|
### 技能定义
|
|
12
16
|
|
|
13
17
|
```json
|
|
@@ -27,8 +31,8 @@
|
|
|
27
31
|
"type": "string"
|
|
28
32
|
},
|
|
29
33
|
"content_type": {
|
|
30
|
-
"description": "
|
|
31
|
-
"enum": [
|
|
34
|
+
"description": "导出内容格式。目前仅支持 1(Markdown 格式)",
|
|
35
|
+
"enum": [1],
|
|
32
36
|
"title": "Content Type",
|
|
33
37
|
"type": "integer"
|
|
34
38
|
}
|
|
@@ -45,11 +49,11 @@
|
|
|
45
49
|
|
|
46
50
|
### 参数说明
|
|
47
51
|
|
|
48
|
-
| 参数
|
|
49
|
-
|
|
50
|
-
| docid
|
|
51
|
-
| url
|
|
52
|
-
| content_type | integer | 是
|
|
52
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
53
|
+
|---|---|---|---|
|
|
54
|
+
| docid | string | 与 url 二选一 | 智能文档的 docid |
|
|
55
|
+
| url | string | 与 docid 二选一 | 智能文档的访问链接 |
|
|
56
|
+
| content_type | integer | 是 | 导出内容格式,目前仅支持 `1`(Markdown 格式) |
|
|
53
57
|
|
|
54
58
|
### 请求示例
|
|
55
59
|
|
|
@@ -83,6 +87,10 @@
|
|
|
83
87
|
|
|
84
88
|
查询智能文档导出任务进度。传入 `task_id` 进行轮询,当 `task_done` 为 `true` 时返回导出内容的本地文件路径。
|
|
85
89
|
|
|
90
|
+
### 调用
|
|
91
|
+
|
|
92
|
+
使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartpage_get_export_result '<JSON 参数>'`
|
|
93
|
+
|
|
86
94
|
### 技能定义
|
|
87
95
|
|
|
88
96
|
```json
|
|
@@ -106,9 +114,9 @@
|
|
|
106
114
|
|
|
107
115
|
### 参数说明
|
|
108
116
|
|
|
109
|
-
| 参数
|
|
110
|
-
|
|
111
|
-
| task_id | string | 是
|
|
117
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
118
|
+
|---|---|---|---|
|
|
119
|
+
| task_id | string | 是 | 导出任务 ID,由 `smartpage_export_task` 返回 |
|
|
112
120
|
|
|
113
121
|
### 请求示例
|
|
114
122
|
|
|
@@ -153,7 +161,7 @@
|
|
|
153
161
|
## 注意事项
|
|
154
162
|
|
|
155
163
|
- `smartpage_export_task` 是异步操作的第一步,调用后仅返回 `task_id`
|
|
156
|
-
- `content_type`
|
|
164
|
+
- `content_type` 目前仅支持 `1`(Markdown 格式)
|
|
157
165
|
- `docid` 和 `url` 二选一传入即可,无需同时传入
|
|
158
166
|
- `content_filepath` 仅在 `task_done` 为 `true` 时返回
|
|
159
167
|
- `content_filepath` 是本地文件路径,使用 Read 工具读取文件内容即可
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: wecom-smartsheet
|
|
3
|
-
description:
|
|
3
|
+
description: 企业微信智能表格(smartsheet)管理技能。提供智能表格的新建(doc_type=10)、结构管理(子表、字段/列)和数据管理(记录增删改查)。适用场景:(1) 从零新建智能表格 (2) 管理智能表格子表和字段/列 (3) 查询、添加、更新、删除智能表格记录。支持通过 docid 或文档 URL 定位文档。当用户提到「企业微信智能表格」「智能表格」,或链接形如 `https://doc.weixin.qq.com/smartsheet/xxx` 时触发该技能。注意:普通文档(`/doc/*`)请用 `wecom-doc`;在线表格(`/sheet/*`)请用 `wecom-sheet`;智能文档/智能主页(`/smartpage/*`)请用 `wecom-smartpage`。
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# 企业微信智能表格管理
|
|
@@ -9,7 +9,7 @@ description: 企业微信智能表格管理技能。提供智能表格的结构
|
|
|
9
9
|
|
|
10
10
|
> ⚠️ **前置条件**:首次调用 `wecom_mcp` 前,必须按 `wecom-preflight` 技能执行前置条件检查,确保工具已加入白名单。
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
资源型技能,负责**智能表格**(`/smartsheet/*`,doc_type=10)的新建、结构(子表、字段/列)与数据(记录)管理。所有接口支持通过 `docid` 或 `url` 二选一定位文档。
|
|
13
13
|
|
|
14
14
|
## 调用方式
|
|
15
15
|
|
|
@@ -17,6 +17,8 @@ description: 企业微信智能表格管理技能。提供智能表格的结构
|
|
|
17
17
|
|
|
18
18
|
使用 `wecom_mcp` tool 调用 `wecom_mcp call doc <tool_name> '<json_params>'` 调用指定技能
|
|
19
19
|
|
|
20
|
+
> 智能表格各接口的 `docid`/`url` 二选一传入即可,以下示例以 `docid` 为主,URL 传入方式以此类推。
|
|
21
|
+
|
|
20
22
|
## 返回格式说明
|
|
21
23
|
|
|
22
24
|
所有接口返回 JSON 对象,包含以下公共字段:
|
|
@@ -28,43 +30,90 @@ description: 企业微信智能表格管理技能。提供智能表格的结构
|
|
|
28
30
|
|
|
29
31
|
当 `errcode` 不为 `0` 时,说明接口调用失败,可重试 1 次;若仍失败,将 `errcode` 和 `errmsg` 展示给用户。
|
|
30
32
|
|
|
33
|
+
### 特殊错误码
|
|
34
|
+
|
|
35
|
+
| errcode | errmsg | 含义 | 处理方式 |
|
|
36
|
+
|---------|--------|------|----------|
|
|
37
|
+
| `851002` | `incompatible doc type` | 文档品类与所调用的接口不匹配 | 确认目标 URL 为 `/smartsheet/*`;若不是,请跳转到对应品类的 skill |
|
|
38
|
+
| `851003` | `no authority` | 无文档权限。在编辑场景,通常是因为机器人不允许编辑由企业成员创建的文档。在**智能表格写入场景**下,若该报错发生在 `smartsheet_add_records` / `smartsheet_update_records`,可引导用户走 Webhook 兜底方案,详见 [webhook-fallback.md](references/webhook-fallback.md)。注意 Webhook 只能更新通过 Webhook 写入的记录,人工创建的记录无法更新 | — |
|
|
39
|
+
|
|
40
|
+
## 接口路由表
|
|
41
|
+
|
|
42
|
+
> **硬规则**:第二列是 `references/xxx.md` 链接的,命中这一行后**先 `read` 对应 references 文件,再构造命令**。写入/读取记录前,先用 `smartsheet_get_sheet` 拿到目标子表的 `sheet_id`,并用 `smartsheet_get_fields` 了解字段类型。
|
|
43
|
+
|
|
44
|
+
| 用户意图 | 参考位置 |
|
|
45
|
+
|---|---|
|
|
46
|
+
| 从零新建智能表格(空白) | 见下方「新建智能表格」 |
|
|
47
|
+
| 查询文档中所有子表 | 见下方「查询子表」 |
|
|
48
|
+
| 添加 / 改名 / 删除子表 | 见下方「子表管理」 |
|
|
49
|
+
| 查询子表字段/列 | 见下方「查询字段」 |
|
|
50
|
+
| 添加字段/列 | [references/smartsheet-field-types.md](references/smartsheet-field-types.md) |
|
|
51
|
+
| 改名 / 删除字段 | 见下方「字段管理」 |
|
|
52
|
+
| 查询子表记录 | [references/smartsheet-get-records.md](references/smartsheet-get-records.md) |
|
|
53
|
+
| 添加记录 / 更新记录 | [references/smartsheet-cell-value-formats.md](references/smartsheet-cell-value-formats.md) |
|
|
54
|
+
| 删除记录 | 见下方「删除记录」 |
|
|
55
|
+
| Webhook 兜底写入 | [references/webhook-fallback.md](references/webhook-fallback.md) |
|
|
56
|
+
|
|
31
57
|
---
|
|
32
58
|
|
|
33
|
-
##
|
|
59
|
+
## 一、新建智能表格
|
|
60
|
+
|
|
61
|
+
### create_doc — 新建智能表格
|
|
34
62
|
|
|
35
|
-
|
|
63
|
+
从零新建一篇企微**智能表格**(doc_type=10):空白。创建成功后返回 `docid` 和 `url`。
|
|
64
|
+
|
|
65
|
+
使用 `wecom_mcp` tool 调用 `wecom_mcp call doc create_doc '{"doc_type": 10, "doc_name": "任务跟踪表"}'`
|
|
66
|
+
|
|
67
|
+
**参数**
|
|
68
|
+
|
|
69
|
+
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
|
70
|
+
|---|---|---|---|---|
|
|
71
|
+
| `doc_type` | int | 是 | — | 固定传 `10`(智能表格) |
|
|
72
|
+
| `doc_name` | string | 是 | — | 表格标题,最多 255 个字符,超过会被截断 |
|
|
73
|
+
|
|
74
|
+
**注意事项**
|
|
75
|
+
|
|
76
|
+
- 新建智能表格文档**默认已含一个子表**,可通过 `smartsheet_get_sheet` 查询其 `sheet_id`,仅需多个子表时才调用 `smartsheet_add_sheet`。
|
|
77
|
+
- `docid` 仅在创建时返回,后续无法再获取,务必保存。
|
|
78
|
+
|
|
79
|
+
---
|
|
36
80
|
|
|
37
|
-
|
|
81
|
+
## 二、智能表格结构管理
|
|
38
82
|
|
|
39
|
-
|
|
83
|
+
### smartsheet_get_sheet — 查询子表
|
|
40
84
|
|
|
41
|
-
|
|
85
|
+
查询文档中所有子表信息,返回 `sheet_id`、`title`、类型等。
|
|
86
|
+
|
|
87
|
+
- 通过 docid:使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartsheet_get_sheet '{"docid": "DOCID"}'`
|
|
88
|
+
- 通过 URL:使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartsheet_get_sheet '{"url": "https://doc.weixin.qq.com/smartsheet/xxx"}'`
|
|
89
|
+
|
|
90
|
+
### smartsheet_add_sheet — 添加子表
|
|
42
91
|
|
|
43
92
|
添加空子表。新子表不含视图、记录和字段,需通过其他接口补充。
|
|
44
93
|
|
|
45
94
|
使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartsheet_add_sheet '{"docid": "DOCID", "properties": {"title": "新子表"}}'`
|
|
46
95
|
|
|
47
|
-
|
|
96
|
+
> 注意:新建智能表格文档默认已含一个子表,仅需多个子表时调用。
|
|
48
97
|
|
|
49
|
-
### smartsheet_update_sheet
|
|
98
|
+
### smartsheet_update_sheet — 修改子表标题
|
|
50
99
|
|
|
51
|
-
|
|
100
|
+
需提供 `sheet_id` 和新 `title`。
|
|
52
101
|
|
|
53
102
|
使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartsheet_update_sheet '{"docid": "DOCID", "properties": {"sheet_id": "SHEET_ID", "title": "新子表"}}'`
|
|
54
103
|
|
|
55
|
-
### smartsheet_delete_sheet
|
|
104
|
+
### smartsheet_delete_sheet — 删除子表
|
|
56
105
|
|
|
57
106
|
永久删除子表,**操作不可逆**。
|
|
58
107
|
|
|
59
108
|
使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartsheet_delete_sheet '{"docid": "DOCID", "sheet_id": "SHEETID"}'`
|
|
60
109
|
|
|
61
|
-
### smartsheet_get_fields
|
|
110
|
+
### smartsheet_get_fields — 查询字段
|
|
62
111
|
|
|
63
|
-
查询子表的所有字段信息,返回 field_id
|
|
112
|
+
查询子表的所有字段信息,返回 `field_id`、`field_title`、`field_type`。
|
|
64
113
|
|
|
65
114
|
使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartsheet_get_fields '{"docid": "DOCID", "sheet_id": "SHEETID"}'`
|
|
66
115
|
|
|
67
|
-
### smartsheet_add_fields
|
|
116
|
+
### smartsheet_add_fields — 添加字段
|
|
68
117
|
|
|
69
118
|
向子表添加一个或多个字段。单个子表最多 150 个字段。
|
|
70
119
|
|
|
@@ -73,39 +122,39 @@ description: 企业微信智能表格管理技能。提供智能表格的结构
|
|
|
73
122
|
在添加字段前,请先参阅所有字段类型和定义 [字段类型参考](references/smartsheet-field-types.md)。
|
|
74
123
|
|
|
75
124
|
> 注意:如果是首次创建表并调用这个方法添加字段的情况下,调用本接口前,你必须确认已完成以下操作,否则会多出一个无用的默认列:
|
|
76
|
-
> 1. 已调用 smartsheet_get_fields 查看子表现有字段(新子表会自带一个默认文本字段)
|
|
77
|
-
> 2. 已调用 smartsheet_update_fields
|
|
125
|
+
> 1. 已调用 `smartsheet_get_fields` 查看子表现有字段(新子表会自带一个默认文本字段)
|
|
126
|
+
> 2. 已调用 `smartsheet_update_fields` 将该默认字段重命名为你需要的第一个字段名,然后在本接口中只传入剩余的字段(不包含第一个字段)。
|
|
78
127
|
|
|
79
|
-
### smartsheet_update_fields
|
|
128
|
+
### smartsheet_update_fields — 更新字段标题
|
|
80
129
|
|
|
81
|
-
|
|
130
|
+
**只能改名,不能改类型**(`field_type` 必须传原始类型)。`field_title` 不能更新为原值。
|
|
82
131
|
|
|
83
132
|
使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartsheet_update_fields '{"docid": "DOCID", "sheet_id": "SHEETID", "fields": [{"field_id": "FIELDID", "field_title": "新标题", "field_type": "FIELD_TYPE_TEXT"}]}'`
|
|
84
133
|
|
|
85
|
-
### smartsheet_delete_fields
|
|
134
|
+
### smartsheet_delete_fields — 删除字段
|
|
86
135
|
|
|
87
|
-
|
|
136
|
+
删除一列或多列字段,**操作不可逆**。`field_id` 可通过 `smartsheet_get_fields` 获取。
|
|
88
137
|
|
|
89
138
|
使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartsheet_delete_fields '{"docid": "DOCID", "sheet_id": "SHEETID", "field_ids": ["FIELDID"]}'`
|
|
90
139
|
|
|
91
140
|
---
|
|
92
141
|
|
|
93
|
-
##
|
|
142
|
+
## 三、智能表格数据管理
|
|
94
143
|
|
|
95
|
-
### smartsheet_get_records
|
|
144
|
+
### smartsheet_get_records — 查询记录
|
|
96
145
|
|
|
97
146
|
查询子表全部记录。
|
|
98
147
|
|
|
99
|
-
- 通过
|
|
148
|
+
- 通过 docid:使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartsheet_get_records '{"docid": "DOCID", "sheet_id": "SHEETID"}'`
|
|
100
149
|
- 或通过 URL:使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartsheet_get_records '{"url": "https://doc.weixin.qq.com/smartsheet/xxx", "sheet_id": "SHEETID"}'`
|
|
101
150
|
|
|
102
151
|
参见 [API 详情](references/smartsheet-get-records.md)。
|
|
103
152
|
|
|
104
|
-
### smartsheet_add_records
|
|
153
|
+
### smartsheet_add_records — 添加记录(不带图片或文件)
|
|
105
154
|
|
|
106
155
|
添加一行或多行记录,单次建议 500 行内。
|
|
107
156
|
|
|
108
|
-
**调用前**必须先了解目标表的字段类型(通过 `smartsheet_get_fields`),并查看[单元格值格式参考](references/smartsheet-cell-value-formats.md)
|
|
157
|
+
**调用前**必须先了解目标表的字段类型(通过 `smartsheet_get_fields`),并查看[单元格值格式参考](references/smartsheet-cell-value-formats.md),了解做法后再实施。对于单选/多选(Option)字段,需注意匹配已有选项的 `id`。
|
|
109
158
|
|
|
110
159
|
使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartsheet_add_records '{"docid": "DOCID", "sheet_id": "SHEETID", "records": [{"values": {"任务名称": [{"type": "text", "text": "完成需求文档"}], "优先级": [{"text": "高"}]}}]}'`
|
|
111
160
|
|
|
@@ -118,16 +167,22 @@ description: 企业微信智能表格管理技能。提供智能表格的结构
|
|
|
118
167
|
|
|
119
168
|
> ⚠️ 若返回 `errcode: 851003` 或 `errmsg` 包含 `no authority`,无文档权限。在编辑场景,通常是因为机器人不允许编辑由企业成员创建的文档。在**智能表格写入场景**下,若该报错发生在 `smartsheet_add_records` / `smartsheet_update_records`,可引导用户走 Webhook 兜底方案,详见 [webhook-fallback.md](references/webhook-fallback.md)。注意 Webhook 只能更新通过 Webhook 写入的记录,人工创建的记录无法更新。
|
|
120
169
|
|
|
121
|
-
###
|
|
170
|
+
### smartsheet_add_records_auto_file — 添加记录(带图片或文件)
|
|
171
|
+
|
|
172
|
+
添加一行或多行记录,单次建议 500 行内。与 `smartsheet_add_records` 不同之处在于,可支持本地路径传入图片、文件。对于需要添加带图片或文件的记录,请使用此接口。传入后台后,后台将自动存储并转换为 `image_url`。
|
|
173
|
+
|
|
174
|
+
使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartsheet_add_records_auto_file '{"docid":"DOCID","sheet_id":"SHEETID","records":[{"values":{"图片":[{"image_path":"/path/to/image.jpg"}],"文件":[{"file_path":"/path/to/file.txt"}]}}]}'`
|
|
175
|
+
|
|
176
|
+
### smartsheet_update_records — 更新记录(不带图片或文件)
|
|
122
177
|
|
|
123
178
|
**调用前**必须先了解目标表的字段类型(通过 `smartsheet_get_fields`),并查看[单元格值格式参考](references/smartsheet-cell-value-formats.md),了解做法后再实施。
|
|
124
179
|
|
|
125
|
-
更新一行或多行记录,单次建议在 500 行内。需提供 record_id
|
|
180
|
+
更新一行或多行记录,单次建议在 500 行内。需提供 `record_id`(通过 `smartsheet_get_records` 获取)。支持通过 `key_type` 指定 values 的 key 使用字段标题或字段 ID:
|
|
126
181
|
|
|
127
182
|
- `CELL_VALUE_KEY_TYPE_FIELD_TITLE`:key 为字段标题
|
|
128
183
|
- `CELL_VALUE_KEY_TYPE_FIELD_ID`:key 为字段 ID
|
|
129
184
|
|
|
130
|
-
使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartsheet_update_records '{"docid": "DOCID", "sheet_id": "SHEETID", "key_type": "
|
|
185
|
+
使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartsheet_update_records '{"docid": "DOCID", "sheet_id": "SHEETID", "key_type": "CELL_VALUE_KEY_TYPE_FIELD_TITLE", "records": [{"record_id": "RECORDID", "values": {"任务名称": [{"type": "text", "text": "更新后的内容"}]}}]}'`
|
|
131
186
|
|
|
132
187
|
**注意**:创建时间、最后编辑时间、创建人、最后编辑人字段不可更新。
|
|
133
188
|
|
|
@@ -138,9 +193,15 @@ description: 企业微信智能表格管理技能。提供智能表格的结构
|
|
|
138
193
|
|
|
139
194
|
> ⚠️ 若返回 `errcode: 851003` 或 `errmsg` 包含 `no authority`,无文档权限。在编辑场景,通常是因为机器人不允许编辑由企业成员创建的文档。在**智能表格写入场景**下,若该报错发生在 `smartsheet_add_records` / `smartsheet_update_records`,可引导用户走 Webhook 兜底方案,详见 [webhook-fallback.md](references/webhook-fallback.md)。注意 Webhook 只能更新通过 Webhook 写入的记录,人工创建的记录无法更新。
|
|
140
195
|
|
|
141
|
-
###
|
|
196
|
+
### smartsheet_update_records_auto_file — 更新记录(更新图片或文件字段)
|
|
197
|
+
|
|
198
|
+
更新一行或多行记录,单次建议在 500 行内。与 `smartsheet_update_records` 不同之处在于,可支持本地路径传入图片、文件。对于需要更新记录中的图片或文件,请使用此接口。传入后台后,后台将自动存储并转换为 `image_url`。
|
|
142
199
|
|
|
143
|
-
|
|
200
|
+
使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartsheet_update_records_auto_file '{"docid": "DOCID", "sheet_id": "SHEETID", "key_type": "CELL_VALUE_KEY_TYPE_FIELD_TITLE", "records": [{"record_id": "RECORDID", "values": {"图片":[{"image_path":"/path/to/image.jpg"}],"文件":[{"file_path":"/path/to/file.txt"}]}}]}'`
|
|
201
|
+
|
|
202
|
+
### smartsheet_delete_records — 删除记录
|
|
203
|
+
|
|
204
|
+
删除一行或多行记录,单次必须在 500 行内。**操作不可逆**。`record_id` 通过 `smartsheet_get_records` 获取。极速版智能表格不支持此接口。
|
|
144
205
|
|
|
145
206
|
使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartsheet_delete_records '{"docid": "DOCID", "sheet_id": "SHEETID", "record_ids": ["RECORDID1", "RECORDID2"]}'`
|
|
146
207
|
|
|
@@ -148,10 +209,15 @@ description: 企业微信智能表格管理技能。提供智能表格的结构
|
|
|
148
209
|
|
|
149
210
|
## 典型工作流
|
|
150
211
|
|
|
212
|
+
### 新建并搭建表结构
|
|
213
|
+
|
|
214
|
+
1. **新建智能表格** → 使用 `wecom_mcp` tool 调用 `wecom_mcp call doc create_doc '{"doc_type": 10, "doc_name": "项目任务表"}'`,保存返回的 `docid`
|
|
215
|
+
2. **了解默认子表** → `smartsheet_get_sheet` 拿到默认子表的 `sheet_id` → `smartsheet_get_fields` 查看默认字段
|
|
216
|
+
3. **搭建列** → 先 `smartsheet_update_fields` 改默认字段名,再 `smartsheet_add_fields` 补充其余字段
|
|
217
|
+
|
|
151
218
|
### 智能表格结构操作
|
|
152
219
|
|
|
153
|
-
1. **了解表结构** →
|
|
154
|
-
使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartsheet_get_sheet` → 使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartsheet_get_fields`
|
|
220
|
+
1. **了解表结构** → 使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartsheet_get_sheet '{"docid": "DOCID"}'` → 使用 `wecom_mcp` tool 调用 `wecom_mcp call doc smartsheet_get_fields '{"docid": "DOCID", "sheet_id": "SHEETID"}'`
|
|
155
221
|
2. **创建表结构** → `smartsheet_add_sheet` 添加子表 → `smartsheet_add_fields` 定义列
|
|
156
222
|
3. **修改表结构** → `smartsheet_update_fields` 改列名 / `smartsheet_delete_fields` 删列
|
|
157
223
|
|
|
@@ -164,5 +230,12 @@ description: 企业微信智能表格管理技能。提供智能表格的结构
|
|
|
164
230
|
5. 若涉及**图片(IMAGE)或文件(ATTACHMENT)**字段,**必须且只能**直接在 cell value 中传入本地路径(`image_path` / `file_path`)。**严禁**调用 `upload_doc_image`、`upload_doc_file` 或任何上传接口,**严禁**进行 base64 编码——无论文件大小、无论 API 返回何种错误,均不得绕过此规则。若返回错误,直接将错误码和错误信息告知用户,不得尝试其他上传方式。传入格式参考 [单元格值格式参考](references/smartsheet-cell-value-formats.md)。
|
|
165
231
|
6. **删除数据** → 先 `smartsheet_get_records` 确认 record_id → `smartsheet_delete_records` 删除
|
|
166
232
|
|
|
167
|
-
|
|
168
|
-
|
|
233
|
+
## 跨技能依赖
|
|
234
|
+
|
|
235
|
+
| 依赖技能 | 典型协作场景 | 数据流向 |
|
|
236
|
+
|---|---|---|
|
|
237
|
+
| `wecom-contact` | 成员(USER)类型字段需填 `user_id`,不能直接用姓名 | `get_userlist` 按姓名查到 userid → 本 skill 写入 |
|
|
238
|
+
| `wecom-msg` | 用户要求把智能表格链接发给某人/某群 | 本 skill 新建后返回 `url` → `wecom-msg` 发送链接 |
|
|
239
|
+
|
|
240
|
+
> **注意**:成员(USER)类型字段需要填写 `user_id`,不能直接使用姓名。必须先通过 `wecom-contact` 技能的 `get_userlist` 接口按姓名查找到对应的 `userid` 后再使用。
|
|
241
|
+
> **注意**:图片(IMAGE)或文件(ATTACHMENT)字段**必须且只能**直接在 cell value 中传入本地路径(`image_path` / `file_path`)。**严禁**调用 `upload_doc_image`、`upload_doc_file` 或任何上传接口,**严禁**进行 base64 编码——无论文件大小、无论 API 返回何种错误,均不得绕过此规则。若返回错误,直接将错误码和错误信息告知用户,不得尝试其他上传方式。格式参考 [单元格值格式参考](references/smartsheet-cell-value-formats.md)。
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# create_doc API
|
|
2
|
-
|
|
3
|
-
新建文档、表格或智能表格。创建成功后返回文档访问链接和 docid。
|
|
4
|
-
|
|
5
|
-
## 技能定义
|
|
6
|
-
|
|
7
|
-
```json
|
|
8
|
-
{
|
|
9
|
-
"name": "create_doc",
|
|
10
|
-
"description": "新建文档、表格或智能表格。支持在指定空间和目录下创建,可设置文档管理员。创建成功后返回文档访问链接和 docid(docid 仅在创建时返回,需妥善保存)。注意:创建智能表格(doc_type=10)时,文档会默认包含一个子表,可通过 smartsheet_get_sheet 查询其 sheet_id,无需额外调用 smartsheet_add_sheet。",
|
|
11
|
-
"inputSchema": {
|
|
12
|
-
"properties": {
|
|
13
|
-
"doc_type": {
|
|
14
|
-
"description": "文档类型:3-文档,10-智能表格",
|
|
15
|
-
"enum": [3, 10],
|
|
16
|
-
"title": "Doc Type",
|
|
17
|
-
"type": "integer"
|
|
18
|
-
},
|
|
19
|
-
"doc_name": {
|
|
20
|
-
"description": "文档名字,最多 255 个字符,超过会被截断",
|
|
21
|
-
"title": "Doc Name",
|
|
22
|
-
"type": "string"
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"required": ["doc_type", "doc_name"],
|
|
26
|
-
"title": "create_docArguments",
|
|
27
|
-
"type": "object"
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## 请求示例
|
|
33
|
-
|
|
34
|
-
```json
|
|
35
|
-
{
|
|
36
|
-
"doc_type": 3,
|
|
37
|
-
"doc_name": "项目周报"
|
|
38
|
-
}
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## 响应示例
|
|
42
|
-
|
|
43
|
-
```json
|
|
44
|
-
{
|
|
45
|
-
"errcode": 0,
|
|
46
|
-
"errmsg": "ok",
|
|
47
|
-
"url": "https://doc.weixin.qq.com/doc/xxx",
|
|
48
|
-
"docid": "DOCID"
|
|
49
|
-
}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## 注意事项
|
|
53
|
-
|
|
54
|
-
- `doc_type=3` 创建文档
|
|
55
|
-
- `doc_type=10` 创建智能表格,默认包含一个子表
|
|
56
|
-
- docid 仅在创建时返回,后续无法再获取,务必保存
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
# edit_doc_content API
|
|
2
|
-
|
|
3
|
-
编辑(覆写)文档内容。
|
|
4
|
-
|
|
5
|
-
## 技能定义
|
|
6
|
-
|
|
7
|
-
```json
|
|
8
|
-
{
|
|
9
|
-
"name": "edit_doc_content",
|
|
10
|
-
"description": "编辑文档内容",
|
|
11
|
-
"inputSchema": {
|
|
12
|
-
"properties": {
|
|
13
|
-
"docid": {
|
|
14
|
-
"description": "文档 id,与 url 二选一传入",
|
|
15
|
-
"title": "Docid",
|
|
16
|
-
"type": "string"
|
|
17
|
-
},
|
|
18
|
-
"url": {
|
|
19
|
-
"description": "文档的访问链接,与 docid 二选一传入",
|
|
20
|
-
"title": "URL",
|
|
21
|
-
"type": "string"
|
|
22
|
-
},
|
|
23
|
-
"content": {
|
|
24
|
-
"description": "覆写的文档内容",
|
|
25
|
-
"title": "Content",
|
|
26
|
-
"type": "string"
|
|
27
|
-
},
|
|
28
|
-
"content_type": {
|
|
29
|
-
"description": "内容类型格式。1:markdown",
|
|
30
|
-
"enum": [1],
|
|
31
|
-
"title": "Content Type",
|
|
32
|
-
"type": "integer"
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
"oneOf": [
|
|
36
|
-
{ "required": ["docid", "content", "content_type"] },
|
|
37
|
-
{ "required": ["url", "content", "content_type"] }
|
|
38
|
-
],
|
|
39
|
-
"title": "edit_doc_contentArguments",
|
|
40
|
-
"type": "object"
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## 请求示例
|
|
46
|
-
|
|
47
|
-
```json
|
|
48
|
-
{
|
|
49
|
-
"docid": "DOCID",
|
|
50
|
-
"content": "# 标题\n\n正文内容",
|
|
51
|
-
"content_type": 1
|
|
52
|
-
}
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## 响应示例
|
|
56
|
-
|
|
57
|
-
```json
|
|
58
|
-
{
|
|
59
|
-
"errcode": 0,
|
|
60
|
-
"errmsg": "ok"
|
|
61
|
-
}
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## 注意事项
|
|
65
|
-
|
|
66
|
-
- `content_type` 当前仅支持 `1`(Markdown 格式)
|
|
67
|
-
- 此操作为**覆写**,会替换文档全部内容
|
|
68
|
-
- 建议先调用 `get_doc_content` 了解当前内容再编辑
|