con un clic
lark-drive
// 飞书云空间:管理云空间中的文件和文件夹。上传和下载文件、创建文件夹、复制/移动/删除文件、查看文件元数据、管理文档评论、管理文档权限、订阅用户评论变更事件。当用户需要上传或下载文件、整理云空间目录、查看文件详情、管理评论、管理文档权限、订阅用户评论变更事件时使用。
// 飞书云空间:管理云空间中的文件和文件夹。上传和下载文件、创建文件夹、复制/移动/删除文件、查看文件元数据、管理文档评论、管理文档权限、订阅用户评论变更事件。当用户需要上传或下载文件、整理云空间目录、查看文件详情、管理评论、管理文档权限、订阅用户评论变更事件时使用。
Volcengine web search skill for timely fact checking, citations, and China-friendly web or image search. Prefer it when answers depend on live facts, recent events, policy or price checks, or source-backed verification.
飞书日历(calendar):提供日历与日程(会议)的全面管理能力。核心场景包括:查看/搜索日程、创建/更新日程、管理参会人、查询忙闲状态及推荐空闲时段。高频操作请优先使用 Shortcuts:+agenda(快速概览今日/近期行程)、+create(创建日程并按需邀请参会人)、+freebusy(查询用户主日历的忙闲信息和rsvp的状态)、+rsvp(回复日程邀请)、+suggestion(针对时间未确定的预约日程需求,提供多个时间推荐方案)。
飞书云文档:创建和编辑飞书文档。从 Markdown 创建文档、获取文档内容、更新文档(追加/覆盖/替换/插入/删除)、上传和下载文档中的图片和文件、搜索云空间文档。当用户需要创建或编辑飞书文档、读取文档内容、在文档中插入图片、搜索云空间文档时使用;如果用户是想按名称或关键词先定位电子表格、报表等云空间对象,也优先使用本 skill 的 docs +search 做资源发现。
飞书即时通讯:收发消息和管理群聊。发送和回复消息、搜索聊天记录、管理群聊成员、上传下载图片和文件、管理表情回复。当用户需要发消息、查看或搜索聊天记录、下载聊天中的文件、查看群成员时使用。
飞书邮箱 — draft, compose, send, reply, forward, read, and search emails; manage drafts, folders, labels, contacts, and attachments. Use when user mentions 起草邮件, 写一封邮件, 拟邮件, 草稿, 发通知邮件, 发送邮件, 发邮件, 回复邮件, 转发邮件, 查看邮件, 看邮件, 读邮件, 搜索邮件, 查邮件, 收件箱, 邮件会话, 编辑草稿, 管理草稿, 下载附件, 邮件文件夹, 邮件标签, 邮件联系人, 监听新邮件, draft, compose, send email, reply, forward, inbox, mail thread.
飞书妙记:获取妙记基础信息(标题、封面、时长)和相关的 AI 产物(总结、待办、章节),下载妙记音视频文件。飞书妙记的 URL 格式为: http(s)://<host>/minutes/<minute-token>
| name | lark-drive |
| version | 1.0.0 |
| description | 飞书云空间:管理云空间中的文件和文件夹。上传和下载文件、创建文件夹、复制/移动/删除文件、查看文件元数据、管理文档评论、管理文档权限、订阅用户评论变更事件。当用户需要上传或下载文件、整理云空间目录、查看文件详情、管理评论、管理文档权限、订阅用户评论变更事件时使用。 |
| metadata | {"requires":{"bins":["lark-cli"]},"cliHelp":"lark-cli drive --help"} |
CRITICAL — 开始前 MUST 先用 Read 工具读取 ../lark-shared/SKILL.md,其中包含认证、权限处理
飞书开放平台中,不同类型的文档有不同的 URL 格式和 Token 处理方式。在进行文档操作(如添加评论、下载文件等)时,必须先获取正确的 file_token。
| URL 格式 | 示例 | Token 类型 | 处理方式 |
|---|---|---|---|
/docx/ | https://example.larksuite.com/docx/doxcnxxxxxxxxx | file_token | URL 路径中的 token 直接作为 file_token 使用 |
/doc/ | https://example.larksuite.com/doc/doccnxxxxxxxxx | file_token | URL 路径中的 token 直接作为 file_token 使用 |
/wiki/ | https://example.larksuite.com/wiki/wikcnxxxxxxxxx | wiki_token | ⚠️ 不能直接使用,需要先查询获取真实的 obj_token |
/sheets/ | https://example.larksuite.com/sheets/shtcnxxxxxxxxx | file_token | URL 路径中的 token 直接作为 file_token 使用 |
/drive/folder/ | https://example.larksuite.com/drive/folder/fldcnxxxx | folder_token | URL 路径中的 token 作为文件夹 token 使用 |
知识库链接(/wiki/TOKEN)背后可能是云文档、电子表格、多维表格等不同类型的文档。不能直接假设 URL 中的 token 就是 file_token,必须先查询实际类型和真实 token。
使用 wiki.spaces.get_node 查询节点信息
lark-cli wiki spaces get_node --params '{"token":"wiki_token"}'
从返回结果中提取关键信息
node.obj_type:文档类型(docx/doc/sheet/bitable/slides/file/mindnote)node.obj_token:真实的文档 token(用于后续操作)node.title:文档标题根据 obj_type 使用对应的 API
| obj_type | 说明 | 使用的 API |
|---|---|---|
docx | 新版云文档 | drive file.comments.*、docx.* |
doc | 旧版云文档 | drive file.comments.* |
sheet | 电子表格 | sheets.* |
bitable | 多维表格 | bitable.* |
slides | 幻灯片 | drive.* |
file | 文件 | drive.* |
mindnote | 思维导图 | drive.* |
# 查询 wiki 节点
lark-cli wiki spaces get_node --params '{"token":"wiki_token"}'
返回结果示例:
{
"node": {
"obj_type": "docx",
"obj_token": "xxxx",
"title": "标题",
"node_type": "origin",
"space_id": "12345678910"
}
}
Wiki Space (知识空间)
└── Wiki Node (知识库节点)
├── obj_type: docx (新版文档)
│ └── obj_token (真实文档 token)
├── obj_type: doc (旧版文档)
│ └── obj_token (真实文档 token)
├── obj_type: sheet (电子表格)
│ └── obj_token (真实文档 token)
├── obj_type: bitable (多维表格)
│ └── obj_token (真实文档 token)
└── obj_type: file/slides/mindnote
└── obj_token (真实文档 token)
Drive Folder (云空间文件夹)
└── File (文件/文档)
└── file_token (直接使用)
| 操作 | 需要的 Token | 说明 |
|---|---|---|
| 读取文档内容 | file_token / 通过 docs +fetch 自动处理 | docs +fetch 支持直接传入 URL |
| 添加局部评论(划词评论) | file_token | 传 --selection-with-ellipsis 或 --block-id 时,drive +add-comment 会创建局部评论;仅支持 docx,以及最终解析为 docx 的 wiki URL |
| 添加全文评论 | file_token | 不传 --selection-with-ellipsis / --block-id 时,drive +add-comment 默认创建全文评论;支持 docx、旧版 doc URL,以及最终解析为 doc/docx 的 wiki URL |
| 下载文件 | file_token | 从文件 URL 中直接提取 |
| 上传文件 | folder_token / wiki_node_token | 目标位置的 token |
| 列出文档评论 | file_token | 同添加评论 |
drive +add-comment 支持两种模式。--selection-with-ellipsis / --block-id 时默认启用,也可显式传 --full-comment;支持 docx、旧版 doc URL,以及最终解析为 doc/docx 的 wiki URL。--selection-with-ellipsis 或 --block-id 时启用;仅支持 docx,以及最终解析为 docx 的 wiki URL。drive +add-comment 的 --content 需要传 reply_elements JSON 数组字符串,例如 --content '[{"type":"text","text":"正文"}]'。doc/docx,不要用 +add-comment。lark-cli schema drive.file.comments.create_v2,再执行 lark-cli drive file.comments create_v2 ...。全文评论省略 anchor,局部评论传 anchor.block_id。drive file.comments list。drive file.comments list 返回的 items 应理解为"评论卡片"列表,每个 item 对应用户界面里看到的一张评论卡片,而不是平铺的互动消息列表。item.reply_list.replies,其中第一条 reply 在用户视角下就是这张卡片里的"评论本身"。items 的长度即可;如果是全量统计,则对所有评论分页返回的 items 长度累加。item.reply_list.replies 的长度之和减去 items 的长度。item.reply_list.replies 的长度之和即可;这个口径包含每张评论卡片里的首条评论。item.has_more=true,说明该评论卡片下还有更多回复未包含在当前返回中;此时需要继续调用 drive file.comment.replys list 拉全后,再做全量回复数 / 总互动数统计。create_time(创建时间)排序。create_time 进行排序:
create_time 降序排列,取第一条create_time 升序排列,取第一条drive file.comments list 返回的第一条即可,不需要额外排序。is_whole=true 的评论(全文评论)无法添加回复,遇到此类评论应提示用户"全文评论不支持回复"。is_solved=true 的评论无法添加回复,遇到此类评论应提示用户"该评论已被解决,无法回复"。drive file.comments batch_query 是已知评论 ID 后的批量查询,需要传入具体的评论 ID 列表。drive file.comments list 用于分页获取评论列表,适合统计评论总数、遍历所有评论,或获取"最新/最后 N 条评论"等场景。| 错误信息 | 原因 | 解决方案 |
|---|---|---|
not exist | 使用了错误的 token | 检查 token 类型,wiki 链接必须先查询获取 obj_token |
permission denied | 没有相关操作权限 | 引导用户检查当前身份对文档/文件是否有相应操作权限;如果需要,可以授予相应权限 |
invalid file_type | file_type 参数错误 | 根据 obj_type 传入正确的 file_type(docx/doc/sheet) |
Shortcut 是对常用操作的高级封装(lark-cli drive +<verb> [flags])。有 Shortcut 的操作优先使用。
| Shortcut | 说明 |
|---|---|
+upload | Upload a local file to Drive |
+download | Download a file from Drive to local |
+add-comment | Add a full-document comment, or a local comment to selected docx text (also supports wiki URL resolving to doc/docx) |
+export | Export a doc/docx/sheet/bitable to a local file with limited polling |
+export-download | Download an exported file by file_token |
+import | Import a local file to Drive as a cloud document (docx, sheet, bitable) |
+move | Move a file or folder to another location in Drive |
+task_result | Poll async task result for import, export, move, or delete operations |
lark-cli schema drive.<resource>.<method> # 调用 API 前必须先查看参数结构
lark-cli drive <resource> <method> [flags] # 调用 API
重要:使用原生 API 时,必须先运行
schema查看--data/--params参数结构,不要猜测字段格式。
copy — 复制文件create_folder — 新建文件夹list — 获取文件夹下的清单batch_query — 批量获取评论create_v2 — 添加全文/局部(划词)评论list — 分页获取文档评论patch — 解决/恢复 评论create —delete — 删除回复list — 获取回复update — 更新回复auth —create — 增加协作者权限transfer_owner —batch_query — 获取文档元数据remove_subscription — 取消订阅用户、应用维度事件subscription — 订阅用户、应用维度事件(本次开放评论添加事件)subscription_status — 查询用户、应用对指定事件的订阅状态get — 获取文件统计信息list — 获取文档的访问者记录| 方法 | 所需 scope |
|---|---|
files.copy | docs:document:copy |
files.create_folder | space:folder:create |
files.list | space:document:retrieve |
file.comments.batch_query | docs:document.comment:read |
file.comments.create_v2 | docs:document.comment:create |
file.comments.list | docs:document.comment:read |
file.comments.patch | docs:document.comment:update |
file.comment.replys.create | docs:document.comment:create |
file.comment.replys.delete | docs:document.comment:delete |
file.comment.replys.list | docs:document.comment:read |
file.comment.replys.update | docs:document.comment:update |
permission.members.auth | docs:permission.member:auth |
permission.members.create | docs:permission.member:create |
permission.members.transfer_owner | docs:permission.member:transfer |
metas.batch_query | drive:drive.metadata:readonly |
user.remove_subscription | docs:event:subscribe |
user.subscription | docs:event:subscribe |
user.subscription_status | docs:event:subscribe |
file.statistics.get | drive:drive.metadata:readonly |
file.view_records.list | drive:file:view_record:readonly |