wecomcli-disk
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese企业微信微盘
WeCom Disk
执行任何命令前,必须先读取并完成wecom-cli技能的公共前置检查。wecomcli-shared
资源型 skill,负责微盘文件的列出、搜索、读取信息、上传、下载、重命名与新建文件夹。
Before executing anycommand, you must first read and complete the public pre-checks in thewecom-cliskill.wecomcli-shared
This is a resource-type skill responsible for listing, searching, reading information, uploading, downloading, renaming files, and creating new folders in WeCom Disk.
适用范围
Scope of Application
适用
Applicable Scenarios
- 列出微盘最近查看的文件
- 按关键词/类型/创建者/共享空间搜索微盘文件或文件夹
- 读取微盘文件基础信息
- 上传本地文件到微盘指定文件夹
- 下载微盘文件到本地
- 重命名微盘文件
- 在微盘中新建文件夹
- List recently viewed files in WeCom Disk
- Search for files or folders in WeCom Disk by keywords/type/creator/shared space
- Read basic information of WeCom Disk files
- Upload local files to a specified folder in WeCom Disk
- Download WeCom Disk files to local device
- Rename WeCom Disk files
- Create new folders in WeCom Disk
不适用
Non-Applicable Scenarios
- 移动微盘文件或文件夹 → 告知用户暂未支持,建议前往企业微信客户端手动操作
- 删除微盘文件 / 复制微盘文件 → 告知用户暂未支持,建议前往企业微信客户端手动操作
- 删除 / 重命名微盘文件夹()、调整目录树结构 → 告知用户暂未支持,建议前往企业微信客户端手动操作
folder - 创建 / 删除共享空间()、修改空间成员与空间设置 → 告知用户暂未支持,建议前往企业微信客户端手动操作
space - 给机器人授予某空间的权限 / 把机器人加入共享空间成员 → 微盘没有该功能,任何渠道都做不到(客户端也不行)。禁止向用户提出这类建议,也不要引导用户"联系空间管理员给机器人授权"
- 修改文件分享权限、生成分享链接、撤销分享、设置访问密码 / 有效期 → 告知用户暂未支持,建议前往企业微信客户端手动操作
- 微盘文件版本管理(查看历史版本、恢复旧版本、比对版本) → 告知用户暂未支持
- 撤销 / 修改已上传的文件(覆盖上传 / 秒传 / 断点续传) → 告知用户暂未支持;如需替换,请重新走「上传文件」上传一份新文件
- 解析微盘文件的内容(正文提取、OCR、看图问答、PDF/Word/Excel 解析等) → 本 skill 负责把文件下载到本地拿
file_path - 视频 / 音频文件的转写或字幕生成 → 告知用户暂未支持
- 持续监视微盘变更 / 实时通知新文件到达 → 无法主动监视,不要承诺「有新文件时告知你」,请让用户稍后主动再次发起查询
- Moving WeCom Disk files or folders → Inform users that this function is not supported yet, and suggest manual operation via the WeCom client
- Deleting/copying WeCom Disk files → Inform users that this function is not supported yet, and suggest manual operation via the WeCom client
- Deleting/renaming WeCom Disk folders (), adjusting directory tree structure → Inform users that this function is not supported yet, and suggest manual operation via the WeCom client
folder - Creating/deleting shared spaces (), modifying space members and settings → Inform users that this function is not supported yet, and suggest manual operation via the WeCom client
space - Granting a robot permission to a space / adding a robot to shared space members → WeCom Disk does not have this function, which cannot be achieved through any channel (including the client). Prohibit making such suggestions to users, and do not guide users to "contact the space administrator to authorize the robot"
- Modifying file sharing permissions, generating sharing links, revoking sharing, setting access passwords/validity periods → Inform users that this function is not supported yet, and suggest manual operation via the WeCom client
- WeCom Disk file version management (viewing historical versions, restoring old versions, comparing versions) → Inform users that this function is not supported yet
- Undoing/modifying uploaded files (overwrite upload, instant upload, resumable upload) → Inform users that this function is not supported yet; if replacement is needed, re-upload a new file via the "upload file" process
- Parsing the content of WeCom Disk files (text extraction, OCR, image-based Q&A, PDF/Word/Excel parsing, etc.) → This skill is responsible for downloading the file to local device and returning the
file_path - Transcribing video/audio files or generating subtitles → Inform users that this function is not supported yet
- Continuously monitoring WeCom Disk changes / real-time notifications for new files → Active monitoring is not possible; do not promise "to notify you when new files arrive", please ask users to initiate a query again later
路由决策(判断本 skill / 其他 skill)
Routing Decision (This Skill / Other Skills)
| 用户输入信号 | 路由到 |
|---|---|
| 明确提"微盘 / 网盘 / disk / Wecom 网盘" | 本 skill |
提供 | 本 skill(作为 |
提供 | 对应 |
在线文档 | 同上对应文档 skill |
| 改文档权限 / 加成员 / 改文档名(针对 doc/sheet/smartsheet/smartpage) | |
注意:/doc.weixin.qq.com是在线文档域名,page.weixin.qq.com才是微盘域名,切勿混用。drive.weixin.qq.com
| User Input Signal | Route To |
|---|---|
| Explicitly mentions "Disk / Cloud Drive / disk / Wecom Cloud Drive" | This skill |
Provides a link in the format | This skill (used as the |
Provides a link in the format | Corresponding |
Reading/writing content of online documents | Corresponding document skills as above |
| Modifying document permissions / adding members / renaming documents (for doc/sheet/smartsheet/smartpage) | |
Note:/doc.weixin.qq.comare domains for online documents, whilepage.weixin.qq.comis the domain for WeCom Disk. Do not confuse them.drive.weixin.qq.com
文件类型枚举
File Type Enumeration
docsheetpptcollectmindflowsmartsheetsmartpagejournalpdfoffline_wordoffline_exceloffline_pptoffline_pdfimagevideoaudiodesignoffline_在线/离线模糊时同时搜:用户说「Excel」「Word」「PPT」「PDF」等未明确在线还是离线时,同时传入在线版和离线版(如file_types),避免遗漏。其余类型按上方枚举名按字面对应传入即可。["sheet", "offline_excel"]
docsheetpptcollectmindflowsmartsheetsmartpagejournalpdfoffline_wordoffline_exceloffline_pptoffline_pdfimagevideoaudiodesignoffline_Search both online and offline when ambiguous: When users mention "Excel", "Word", "PPT", "PDF", etc. without specifying online or offline, pass both online and offline versions in(e.g.,file_types) to avoid omissions. For other types, pass the corresponding enumeration names as they are.["sheet", "offline_excel"]
接口详述
Interface Details
列出文件
List Files
获取用户微盘最近查看的文件列表,支持分页。
命令
bash
wecom-cli disk files list --json '{"limit": 10}'入参
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| string | 否 | | 分页游标;不传或传空串则获取首页数据 |
| number | 否 | 10 | 每页返回的最大条数;不传则使用服务默认值,最大 100 |
返回
| 字段 | 类型 | 说明 |
|---|---|---|
| boolean | 是否还有更多数据; |
| string | 下一页游标 |
| string | 文件 ID 或文件夹 ID |
| string | 文件名称 |
| string | 文档 ID,仅 |
| string | 文件类型: |
| number | 文件大小(字节);仅 |
| string | 创建者 userid |
| string | 所属共享空间 ID |
| string | 所在共享空间名称 |
| string | 所在文件夹 ID |
| string | 所在文件夹名称 |
| string | 创建时间, |
| string | 最后更新时间, |
| string | 文件完整路径 |
| string | 文档打开链接,仅在线文档类型( |
Retrieve the list of recently viewed files in the user's WeCom Disk, supporting pagination.
Command
bash
wecom-cli disk files list --json '{"limit": 10}'Parameters
| Field | Type | Required | Default Value | Description |
|---|---|---|---|---|
| string | No | | Pagination cursor; if not passed or passed as an empty string, retrieve the first page of data |
| number | No | 10 | Maximum number of items returned per page; if not passed, use the service default value, maximum 100 |
Return
| Field | Type | Description |
|---|---|---|
| boolean | Whether there is more data; use |
| string | Cursor for the next page |
| string | File ID or folder ID |
| string | File name |
| string | Document ID, only meaningful for |
| string | File type: |
| number | File size (bytes); only meaningful for |
| string | Creator userid |
| string | ID of the associated shared space |
| string | Name of the shared space |
| string | ID of the parent folder |
| string | Name of the parent folder |
| string | Creation time, in |
| string | Last update time, in |
| string | Full path of the file |
| string | Document opening link, only filled for online document types ( |
搜索文件
Search Files
按关键词、文件类型、创建者、共享空间、排序等条件搜索微盘文件、文件夹或共享空间。
命令
bash
wecom-cli disk files search --json '{"keywords": ["季度汇报"], "search_type": "file", "sort_by": "modify_time", "sort_order": "desc", "limit": 10}'入参
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| string[] | 选填 | — | 字面关键词数组,长度 0~20(or 关系);与 |
| string[] | 选填 | — | 限定创建者 |
| string | 选填 | | 查询范围枚举: |
| string[] | 选填 | — | 限定文件类型,长度 0~10;可选 |
| string[] | 否 | — | 限定所在空间名称的关键词,长度 0~10,or 关系;命中的 space 会被作为搜索范围;不传则不限空间;附加过滤条件,不能单独触发搜索 |
| string | 否 | | 排序方式: |
| string | 否 | | 排序方向: |
| string | 否 | — | 分批拉取增量 key,上一次请求返回的 |
| number | 否 | 10 | 每页最大返回条数,最大 100 |
返回
| 字段 | 类型 | 说明 |
|---|---|---|
| boolean | 是否还有更多数据; |
| string | 下一页游标 |
| string | 微盘文件 ID / 文件夹 ID / 空间 ID |
| string | 命中项类型: |
| string | 名称(文件名 / 文件夹名 / 空间名) |
| number | 文件大小(字节),仅 |
| string | 创建者 userid |
| string | 所在共享空间 ID |
| string | 所在共享空间名称 |
| string | 所在父文件夹 ID;位于空间根目录时等于 |
| string | 所在文件夹名称 |
| string | 文件完整路径; |
| string | 创建时间, |
| string | 最近更新时间, |
| string | 文档 ID,仅 |
| string | 文档打开链接,仅在线文档类型时填充;可直接作为在线文档分享链接发送给用户/群,无需额外处理 |
| string[] | 标题命中关键词的高亮摘要片段; |
| string[] | 正文命中关键词的高亮摘要片段; |
在线文档命中项处理约束——极重要:搜索返回的若为type/smartsheet/smartpage/sheet/word/ppt/journal/collect/mind,这些是在线协作文档(正文存云端,非二进制文件),禁止走flow(会失败或拿到空壳),也不适合走disk files download。其中disk files get/smartsheet/smartpage/sheet有对应的下游 skill 可读正文,路由见文末【跨技能依赖】表;word/ppt/journal/collect/mind目前没有任何下游 skill 或 CLI 能读取正文,命中这些类型且用户要看内容时,直接告知暂不支持读取,引导用户用flow在企业微信客户端内打开查看。仅当doc_url时才可用type=file作为id调file_id拿本地文件。disk files download
使用规则
-
触发条件(唯一权威描述):/
keywords/creator_userids/search_type四选一,至少传一个;file_types只是附加过滤条件,不能单独触发搜索。若四者全空则用自然语言追问后再发起搜索。若用户仅给出空间关键词(如「在 XX 空间里搜一下」),可用自然语言追问具体搜索内容。space_keywords -
多次搜不到就如实告知:多次调整关键词/类型后仍无结果时,停止搜索,如实告知用户是「搜不到文件」还是「搜不到该空间」,不要反复换词硬搜。
-
可选参数传值策略——默认不传,仅在用户明确点名时才传:
参数 何时不传(后端默认) 何时传(用户明确表达时) search_type用户笼统说"搜一下 xxx / 找 xxx / 文件 / 资料"等未明确对象类型 → 后端按 all明确说"只搜文件夹 / 目录"→ ;"只搜共享空间 / 团队空间"→folder;"只要文件,不要文件夹"→spacefilesort_by用户无排序偏好 → 后端按 best_match"最新 / 最近改 / 最早"→ ;"最大 / 最小"→modify_timefile_sizesort_order时无需传sort_by=best_match传 /modify_time时按新→旧用file_size、旧→新用desc;不传则默认ascdescfile_types用户笼统说"文档 / 文件 / 资料 / 材料"或业务概念(合同 / 报告 / 会议纪要)→ 不过滤,靠 兑现keywords用户明确点到具体形态(PPT / Excel / PDF / 图片 / 智能表格 等),把对应枚举一并塞入数组 space_keywords不限空间时 用户说"在 XX 空间 / XX 团队盘里搜" → 填空间名关键词(本接口不接受 )space_id -
不要混入文件类型后缀:用户说「搜一下 Excel 报告」「找 PPT 方案」时,文件类型后缀(Excel/PPT/Word/PDF)交给
keywords过滤,file_types只保留业务关键词(如「报告」「方案」)。例:「Excel 报告」→keywords+keywords:["报告"]。file_types:["sheet","offline_excel"] -
口语→枚举映射:见上方「文件类型枚举」表中的「用户口语表达」列。
file_types -
分页续传:时用
has_more=true作为下一次调用的next_cursor;首次调用cursor传空串。cursor -
不支持时间范围过滤:本接口没有/
begin_time字段,禁止伪造;若用户给出"最近 3 天 / 上周 / 本月"等时间范围,先按end_time,sort_by=modify_time拉取,再由客户端根据sort_order=desc二次筛选。update_time -
结果总结顺序跟随排序方向:(默认,新→旧)时,向用户总结结果也应从最新到最旧展示,不要颠倒顺序。
sort_order=desc
Search for WeCom Disk files, folders, or shared spaces by conditions such as keywords, file type, creator, shared space, and sorting.
Command
bash
wecom-cli disk files search --json '{"keywords": ["Quarterly Report"], "search_type": "file", "sort_by": "modify_time", "sort_order": "desc", "limit": 10}'Parameters
| Field | Type | Required | Default Value | Description |
|---|---|---|---|---|
| string[] | Optional | — | Array of literal keywords, length 0~20 (OR relationship); select at least one from |
| string[] | Optional | — | List of restricted creator |
| string | Optional | | Enumeration of query scope: |
| string[] | Optional | — | Restricted file types, length 0~10; optional values include |
| string[] | No | — | Keywords restricting the space name, length 0~10, OR relationship; matching spaces will be used as the search scope; no space restriction if not passed; additional filtering condition, cannot trigger search alone |
| string | No | | Sorting method: |
| string | No | | Sorting direction: |
| string | No | — | Incremental key for batch retrieval, |
| number | No | 10 | Maximum number of items returned per page, maximum 100 |
Return
| Field | Type | Description |
|---|---|---|
| boolean | Whether there is more data; use |
| string | Cursor for the next page |
| string | WeCom Disk file ID / folder ID / space ID |
| string | Type of the matched item: |
| string | Name (file name / folder name / space name) |
| number | File size (bytes), only meaningful for |
| string | Creator userid |
| string | ID of the associated shared space |
| string | Name of the shared space |
| string | ID of the parent folder; equals |
| string | Name of the parent folder |
| string | Full path of the file; when |
| string | Creation time, in |
| string | Last update time, in |
| string | Document ID, only meaningful for |
| string | Document opening link, only filled for online document types; can be directly sent to users/groups as an online document sharing link without additional processing |
| string[] | Highlighted summary fragments of the title matching the keywords; empty when |
| string[] | Highlighted summary fragments of the content matching the keywords; empty when |
Critical Constraint for Handling Online Document Matches: If thereturned by the search istype/smartsheet/smartpage/sheet/word/ppt/journal/collect/mind, these are online collaborative documents (content stored in the cloud, not binary files). Prohibit usingflow(will fail or return an empty file), and it is not suitable to usedisk files download. Fordisk files get/smartsheet/smartpage/sheet, there are corresponding downstream skills to read the content; refer to the Cross-Skill Dependencies table at the end for routing; currently, no downstream skills or CLI can read the content ofword/ppt/journal/collect/mind. When users want to view the content of these types, directly inform them that content reading is not supported yet, and guide them to open theflowin the WeCom client. Only whendoc_urlcan thetype=filebe used asidto callfile_idto get the local file.disk files download
Usage Rules
-
Trigger Condition (Authoritative Description): Select at least one from/
keywords/creator_userids/search_type;file_typesis only an additional filtering condition and cannot trigger search alone. If all four are empty, ask the user for clarification in natural language before initiating the search. If the user only provides space keywords (e.g., "search in XX space"), ask for specific search content in natural language.space_keywords -
Inform Truthfully if No Results Found: If no results are found after adjusting keywords/types multiple times, stop searching and inform the user truthfully whether "no files found" or "no such space found"; do not repeatedly change keywords to force a search.
-
Optional Parameter Passing Strategy: Default to not passing, only pass when explicitly specified by the user:
Parameter When Not to Pass (Backend Default) When to Pass (Explicitly Expressed by User) search_typeUser says "search for xxx / find xxx / files / materials" without specifying the object type → Backend uses allExplicitly says "only search folders / directories"→ ; "only search shared spaces / team spaces"→folder; "only files, no folders"→spacefilesort_byUser has no sorting preference → Backend uses best_match"Latest / recently modified / earliest"→ ; "Largest / smallest"→modify_timefile_sizesort_orderNot required when sort_by=best_matchUse for new→old anddescfor old→new when passingasc/modify_time; default tofile_sizeif not passeddescfile_typesUser says "documents / files / materials / resources" or business concepts (contracts / reports / meeting minutes) → No filtering, rely on keywordsUser explicitly mentions specific formats (PPT / Excel / PDF / images / smart spreadsheets, etc.), add the corresponding enumerations to the array space_keywordsNo space restriction User says "search in XX space / XX team disk" → Fill in space name keywords (this interface does not accept )space_id -
Do Not Mix File Type Suffixes in: When users say "search for Excel reports" or "find PPT plans", pass the file type suffixes (Excel/PPT/Word/PDF) to
keywordsfor filtering, and only keep business keywords infile_types(e.g., "reports" / "plans"). Example: "Excel report" →keywords+keywords:["report"].file_types:["sheet","offline_excel"] -
Spoken Language → Enumeration Mapping for: Refer to the "User Spoken Expression" column in the File Type Enumeration table above.
file_types -
Pagination Continuation: Useas the
next_cursorfor the next call whencursor; pass an empty string forhas_more=truein the first call.cursor -
Time Range Filtering Not Supported: This interface does not have/
begin_timefields; do not forge them. If users provide time ranges such as "last 3 days / last week / this month", first retrieve data withend_time,sort_by=modify_time, then perform secondary filtering on the client side based onsort_order=desc.update_time -
Result Summary Order Follows Sorting Direction: When(default, new→old), summarize results for users from newest to oldest, do not reverse the order.
sort_order=desc
读取文件信息
Read File Information
根据 或微盘文件 URL 读取文件基础信息。
file_id命令
bash
wecom-cli disk files get --json '{"file_id": "FILE_ID"}'入参
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| string | 二选一 | — | 文件 ID;与 |
| string | 二选一 | — | 微盘文件分享 URL(形如 |
返回
| 字段 | 类型 | 说明 |
|---|---|---|
| string | 文件 ID 或文件夹 ID |
| string | 文件名称 |
| string | 文档 ID,仅 |
| string | 文件类型: |
| number | 文件大小(字节);仅 |
| string | 创建者 userid |
| string | 所属共享空间 ID |
| string | 所在共享空间名称 |
| string | 所在文件夹 ID,可能为文件夹 |
| string | 所在文件夹名称 |
| string | 创建时间, |
| string | 最后更新时间, |
| string | 文件完整路径 |
| string | 文档打开链接,仅在线文档类型( |
Read basic file information based on or WeCom Disk file URL.
file_idCommand
bash
wecom-cli disk files get --json '{"file_id": "FILE_ID"}'Parameters
| Field | Type | Required | Default Value | Description |
|---|---|---|---|---|
| string | Either | — | File ID; choose either |
| string | Either | — | WeCom Disk file sharing URL (in the format |
Return
| Field | Type | Description |
|---|---|---|
| string | File ID or folder ID |
| string | File name |
| string | Document ID, only meaningful for |
| string | File type: |
| number | File size (bytes); only meaningful for |
| string | Creator userid |
| string | ID of the associated shared space |
| string | Name of the shared space |
| string | ID of the parent folder, may be the folder |
| string | Name of the parent folder |
| string | Creation time, in |
| string | Last update time, in |
| string | Full path of the file |
| string | Document opening link, only filled for online document types ( |
上传文件
Upload File
将本地文件上传到微盘指定目录。支持两种上传方式:A. 素材方式 上下文中已有 时直接传 ;B. 本地路径方式 直接传 。两者二选一。
media_idfile_content_mediafile_path命令
bash
wecom-cli disk files upload --json '{"folder_id": "FOLDER_ID", "file_name": "季度汇报.pptx", "file_content_media": "mcxxx"}'或直接使用本地文件路径:
bash
wecom-cli disk files upload --json '{"folder_id": "FOLDER_ID", "file_name": "季度汇报.pptx", "file_path": "/tmp/季度汇报.pptx"}'入参
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| string | 否 | — | 目标文件夹 ID;可传文件夹 |
| string | 条件必填 | — | 文件名称(含扩展名);长度 1~255;禁止包含字符 |
| string | 二选一 | — | 文件素材的 |
| string | 二选一 | — | 本地文件绝对路径;与 |
返回
| 字段 | 类型 | 说明 |
|---|---|---|
| string | 上传后的文件 ID |
| string | 文件名称 |
| string | 文档 ID,仅 |
| string | 文件类型 |
| number | 文件大小(字节);仅 |
| string | 创建者 userid |
| string | 所属共享空间 ID |
| string | 所在共享空间名称 |
| string | 所在文件夹 ID |
| string | 所在文件夹名称 |
| string | 创建时间 |
| string | 最后更新时间 |
| string | 文件完整路径 |
| string | 文档打开链接,仅在线文档类型时填充 |
使用规则
上传分两条路径,按用户手上的素材形态选一条即可:
路径 A:素材方式()
file_content_media适用场景:上下文中已有可用的 (前置技能返回的、或用户直接给出的),无需再走 。
media_idmedia +upload- 确认 :用户没提供时不传则默认上传到默认空间
folder_id - 直接把已有的 填入
media_id,调file_content_mediadisk files upload
路径 B:本地路径方式()
file_path- 用户已经明确给出本地文件路径(或前置技能返回了本地 ,例如
file_path下载后的路径)时可直接使用disk files download - 确认 :用户没提供时不传则默认上传到默认空间
folder_id - 直接把本地路径填入 ,调
file_path(不需要再走disk files upload)wecomcli-media
二选一互斥:与file_content_media只能选其中之一,不能同时传,也不能都不传。用户既没给file_path也没给本地文件路径时用自然语言追问,禁止靠搜索/幻觉凑一个文件。media_id
Upload local files to a specified directory in WeCom Disk. Two upload methods are supported: A. Media Method directly pass when is available in the context; B. Local Path Method directly pass . Choose one of the two methods.
file_content_mediamedia_idfile_pathCommand
bash
wecom-cli disk files upload --json '{"folder_id": "FOLDER_ID", "file_name": "Quarterly Report.pptx", "file_content_media": "mcxxx"}'Or use the local file path directly:
bash
wecom-cli disk files upload --json '{"folder_id": "FOLDER_ID", "file_name": "Quarterly Report.pptx", "file_path": "/tmp/Quarterly Report.pptx"}'Parameters
| Field | Type | Required | Default Value | Description |
|---|---|---|---|---|
| string | No | — | Target folder ID; can pass folder |
| string | Conditionally Required | — | File name (including extension); length 1~255; prohibited characters: |
| string | Either | — | |
| string | Either | — | Absolute path of the local file; choose either |
Return
| Field | Type | Description |
|---|---|---|
| string | ID of the uploaded file |
| string | File name |
| string | Document ID, only meaningful for |
| string | File type |
| number | File size (bytes); only meaningful for |
| string | Creator userid |
| string | ID of the associated shared space |
| string | Name of the shared space |
| string | ID of the parent folder |
| string | Name of the parent folder |
| string | Creation time |
| string | Last update time |
| string | Full path of the file |
| string | Document opening link, only filled for online document types |
Usage Rules
There are two upload paths, choose one based on the material form available to the user:
Path A: Media Method ()
file_content_mediaApplicable scenario: A valid is already available in the context (returned by a preceding skill or directly provided by the user), no need to go through again.
media_idmedia upload- Confirm : If not provided by the user, do not pass it to upload to the default space
folder_id - Directly fill the existing into
media_idand callfile_content_mediadisk files upload
Path B: Local Path Method ()
file_path- Can be used directly when the user explicitly provides a local file path (or a preceding skill returns a local , such as the path after downloading via
file_path)disk files download - Confirm : If not provided by the user, do not pass it to upload to the default space
folder_id - Directly fill the local path into and call
file_path(no need to go throughdisk files upload)wecomcli-media
Mutually Exclusive: Only one ofandfile_content_mediacan be selected, cannot pass both or neither. If the user provides neitherfile_pathnor local file path, ask for clarification in natural language; do not fabricate a file through search/illusion.media_id
下载文件
Download File
将微盘文件下载到本地,返回本地文件路径。
命令
bash
wecom-cli disk files download --json '{"file_id": "FILE_ID"}'入参
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| string | 二选一 | — | 要下载的文件 ID,与 |
| string | 二选一 | — | 文件 URL,与 |
返回
| 字段 | 类型 | 说明 |
|---|---|---|
| string | 框架保存为本地文件后返回的文件路径 |
| string | 文件内容(内容不长时直接返回字符串) |
| number | 文件大小,单位字节 |
使用规则
- 仅适用于离线二进制文件:只有 (对应
type=file中的file_types/offline_word/offline_excel/offline_ppt/offline_pdf/image/videoaudio)才能通过本接口下载到本地。design - 在线文档形态一律不走下载:若搜索返回的 是
type/smartsheet/smartpage/sheet/word/ppt/journal/collect/mind,禁止把它们的flow或id当doc_url/file_id传入本接口,会失败或拿到无效文件。其中url/smartsheet/smartpage/sheet要读取内容请按文末【跨技能依赖】表用word路由到对应的下游文档技能;docid/ppt/journal/collect/mind目前没有下游技能可读正文,直接告知用户暂不支持,引导其用flow在企业微信客户端内打开查看。doc_url - URL 形态识别:只有 是微盘文件分享 URL,可作为
https://drive.weixin.qq.com/s?k=...参数;url/https://doc.weixin.qq.com/...都是在线文档链接,禁止传入本接口。https://page.weixin.qq.com/...
Download WeCom Disk files to local device and return the local file path.
Command
bash
wecom-cli disk files download --json '{"file_id": "FILE_ID"}'Parameters
| Field | Type | Required | Default Value | Description |
|---|---|---|---|---|
| string | Either | — | ID of the file to download, choose either |
| string | Either | — | File URL, choose either |
Return
| Field | Type | Description |
|---|---|---|
| string | Local file path returned after the framework saves the file |
| string | File content (returned as a string if the content is not long) |
| number | File size, in bytes |
Usage Rules
- Only Applicable to Offline Binary Files: Only files with (corresponding to
type=file/offline_word/offline_excel/offline_ppt/offline_pdf/image/videoaudioindesign) can be downloaded to local device via this interface.file_types - Never Use Download for Online Documents: If the returned by the search is
type/smartsheet/smartpage/sheet/word/ppt/journal/collect/mind, prohibit passing theirfloworidasdoc_url/file_idto this interface, which will fail or return an invalid file. Forurl/smartsheet/smartpage/sheet, use thewordto route to the corresponding downstream document skills according to the Cross-Skill Dependencies table at the end to read content; currently, no downstream skills can read the content ofdocid/ppt/journal/collect/mind, directly inform users that this is not supported yet, and guide them to open theflowin the WeCom client.doc_url - URL Format Identification: Only is a WeCom Disk file sharing URL, which can be used as the
https://drive.weixin.qq.com/s?k=...parameter;url/https://doc.weixin.qq.com/...are online document links, prohibited from being passed to this interface.https://page.weixin.qq.com/...
重命名文件
Rename File
修改微盘文件名称。
命令
bash
wecom-cli disk files rename --json '{"file_id": "FILE_ID", "new_name": "新文件名称.xlsx"}'入参
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| string | 是 | — | 文件 ID(必填) |
| string | 是 | — | 新的文件名称(必填,含扩展名);长度 1~255;禁止包含字符 |
返回
| 字段 | 类型 | 说明 |
|---|---|---|
| string | 操作结果,成功时为 |
本接口不返回对象;如需最新元数据,可再走「读取文件信息」。file
Modify the name of a WeCom Disk file.
Command
bash
wecom-cli disk files rename --json '{"file_id": "FILE_ID", "new_name": "New File Name.xlsx"}'Parameters
| Field | Type | Required | Default Value | Description |
|---|---|---|---|---|
| string | Yes | — | File ID (required) |
| string | Yes | — | New file name (required, including extension); length 1~255; prohibited characters: |
Return
| Field | Type | Description |
|---|---|---|
| string | Operation result, |
This interface does not return aobject; to retrieve the latest metadata, call "Read File Information" again.file
创建文件夹
Create Folder
在微盘指定目录下创建新文件夹。
命令
bash
wecom-cli disk folders create --json '{"folder_id": "FOLDER_ID", "folder_name": "新建文件夹"}'入参
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| string | 选填 | — | 目标父文件夹 ID;可传文件夹 |
| string | 是 | — | 文件夹名称 |
返回
| 字段 | 类型 | 说明 |
|---|---|---|
| string | 文件夹 ID |
| string | 文件夹名称 |
| string | 文档 ID,仅在线文档类型时有意义 |
| string | 文件类型: |
| number | 文件大小(字节);仅 |
| string | 创建者 userid |
| string | 所属共享空间 ID |
| string | 所在空间名;对空间有权限时才返回,与 |
| string | 所在父文件夹 ID,可能为文件夹 |
| string | 所在父文件夹名;对父文件夹有权限时才返回,与 |
| string | 创建时间, |
| string | 最后更新时间, |
| string | 文件夹完整路径 |
| string | 文档打开链接,仅在线文档类型时填充 |
Create a new folder in a specified directory of WeCom Disk.
Command
bash
wecom-cli disk folders create --json '{"folder_id": "FOLDER_ID", "folder_name": "New Folder"}'Parameters
| Field | Type | Required | Default Value | Description |
|---|---|---|---|---|
| string | Optional | — | ID of the target parent folder; can pass folder |
| string | Yes | — | Folder name |
Return
| Field | Type | Description |
|---|---|---|
| string | Folder ID |
| string | Folder name |
| string | Document ID, only meaningful for online document types |
| string | File type: |
| number | File size (bytes); only meaningful for |
| string | Creator userid |
| string | ID of the associated shared space |
| string | Name of the space; returned only when having permission to the space, appears together with |
| string | ID of the parent folder, may be the folder |
| string | Name of the parent folder; returned only when having permission to the parent folder, appears together with |
| string | Creation time, in |
| string | Last update time, in |
| string | Full path of the folder |
| string | Document opening link, only filled for online document types |
关键约束
Key Constraints
- 文件名不是 :用户给的是文件名/关键词时,先走
file_id拿disk files search,禁止把文件名直接当file_id拼接。file_id - 上传素材来源约束:的
upload与file_content_media二选一,两者必须提供其一,不能同时传。file_path必须是合法的file_content_media(前缀media_id),禁止自行构造或猜测;mc只能是用户明确给出或前置技能返回的真实本地文件路径,禁止编造。两者都没有时用自然语言追问,禁止靠搜索/幻觉凑一个文件。file_path - 搜索必须有界:一组条件搜完必要时再调整一次;2~3 轮仍无结果就停下来如实告知用户"未搜到",并请用户提供更准确的关键词/文件类型/创建者,禁止无限换关键词硬搜。
- CLI 报错原样转达:命令返回明确错误码时如实告知用户并给替代建议,禁止用 curl / python 等通用手段绕过 CLI 强行完成。
- 内部 ID 不外露:/
creator_userid/space_id/folder_id/file_id等任何 ID 仅用于后续接口调用,禁止直接展示给用户;docid若需展示创建者信息,先用creator_userid解析为姓名。wecomcli-contact - 重名空间/文件夹时追问:搜索返回多个同名空间或文件夹时,用自然语言追问让用户选择具体目标,禁止随意选第一个或猜一个。
- 参数缺失 / 多候选 / 意图确认:用自然语言追问让用户明确,不要瞎猜。
- File Name is Not : When the user provides a file name/keyword, first use
file_idto get thedisk files search; do not directly use the file name asfile_id.file_id - Upload Material Source Constraint: Choose one of and
file_content_mediaforfile_path, one must be provided, cannot pass both.uploadmust be a validfile_content_media(prefixmedia_id), do not construct or guess it;mccan only be a real local file path explicitly provided by the user or returned by a preceding skill, do not fabricate it. If neither is available, ask for clarification in natural language; do not fabricate a file through search/illusion.file_path - Search Must Be Bounded: Adjust conditions once if necessary after a set of searches; stop and inform users "no results found" after 2~3 rounds of unsuccessful searches, and ask users to provide more accurate keywords/file types/creators; do not keep changing keywords to force a search.
- Convey CLI Errors as They Are: If the command returns a clear error code, inform users truthfully and provide alternative suggestions; do not bypass the CLI using curl/python or other general methods to force completion.
- Do Not Expose Internal IDs: Internal IDs such as /
creator_userid/space_id/folder_id/file_idare only used for subsequent interface calls; prohibit directly displaying them to users; if need to display creator information fordocid, first resolve it to a name viacreator_userid.wecomcli-contact - Ask for Clarification When Spaces/Folders Have the Same Name: If the search returns multiple spaces or folders with the same name, ask users to select the specific target in natural language; do not randomly select the first one or guess.
- Ask for Clarification When Parameters Are Missing / Multiple Candidates / Intent is Unclear: Ask users to clarify in natural language, do not guess.
结果展示规范
Result Display Specifications
向用户展示 / 结果时严格遵守:
listsearch- 用 markdown 无序列表逐条展示,禁止使用表格——最多展示 10 条。
- 每条首行:该项返回的 非空时(在线文档),写成
doc_url形式的 markdown 链接;- [文件名](doc_url)为空时(离线文件、文件夹、空间等),写成doc_url,不得编造链接。副行可展示- 文件名/path/ 可读的update_time(如file_size),字段之间用2.4 MB或空格分隔。· - 禁止直接展示原始 JSON、/
creator_userid/space_id/folder_id等内部 ID。id
Strictly follow these rules when displaying / results to users:
listsearch- Display item by item using markdown unordered lists, prohibit using tables — display a maximum of 10 items.
- First line of each item: If the returned is not empty (online document), write it as a markdown link in the format
doc_url; if- [File Name](doc_url)is empty (offline files, folders, spaces, etc.), write it asdoc_url, do not fabricate links. Secondary lines can display- File Name/path/ readableupdate_time(e.g.,file_size), separate fields with2.4 MBor spaces.· - Prohibit directly displaying raw JSON, internal IDs such as /
creator_userid/space_id/folder_id.id
跨技能依赖
Cross-Skill Dependencies
| 依赖技能 | 何时触发 | 使用被依赖 skill 做什么 |
|---|---|---|
| 搜索命中项 | 拿返回的 |
| 搜索命中项 | 拿返回的 |
| 搜索命中项 | 拿返回的 |
| 搜索命中项 | 拿返回的 |
| 命中项是 word/sheet/smartsheet/smartpage 且用户要求改文档权限 / 加成员 / 改文档名 | 交由 |
参数缺失 / 多候选 / 意图确认时,用自然语言追问让用户明确。
| Dependent Skill | Trigger Condition | Purpose of Using the Dependent Skill |
|---|---|---|
| Search matches | Pass the returned |
| Search matches | Pass the returned |
| Search matches | Pass the returned |
| Search matches | Pass the returned |
| Matched item is word/sheet/smartsheet/smartpage and user requests to modify document permissions / add members / rename the document | Hand over to |
When parameters are missing / multiple candidates / intent is unclear, ask users to clarify in natural language.