Feishu Bitable (多维表格) Skill
执行前必读
- 写记录前:先调用
field list 获取字段 type/ui_type,否则格式极易出错
- 默认表的空行坑:
app create 自带的默认表中会有空记录!插入数据前先 record list + record batch_delete 清空
- 人员字段:默认 open_id(ou_...),值必须是
[{id:"ou_xxx"}](数组对象)
- 日期字段:毫秒时间戳(例如
1674206443000),不是秒
- 单选字段:字符串(例如
"选项1"),不是数组
- 多选字段:字符串数组(例如
["选项1", "选项2"])
- 附件字段:必须先上传到当前多维表格,使用返回的 file_token
- 批量上限:单次 ≤ 500 条,超过需分批
- 并发限制:同一数据表不支持并发写,需串行调用
快速索引:意图 → 工具调用
⚠️ CLI 支持的动作(标注 ✅)可直接用 python3 skills/feishu-cli/run.py 调用;未标注的需改用 api 原始调用。
| 用户意图 |
module |
tool_action |
必填参数 |
常用可选 |
| ✅ 查表有哪些字段 |
bitable |
list_fields |
app_token, table_id |
- |
| ✅ 查记录 |
bitable |
list_records |
app_token, table_id |
filter, sort, field_names |
| ✅ 新增一行 |
bitable |
create_record |
app_token, table_id, fields |
- |
| ✅ 更新一行 |
bitable |
update_record |
app_token, table_id, record_id, fields |
- |
| ✅ 删除记录 |
bitable |
delete_record |
app_token, table_id, record_id |
- |
| ✅ 查看所有表 |
bitable |
list_tables |
app_token |
- |
| 🔧 批量导入 |
api |
POST /bitable/v1/apps/{app_token}/tables/{table_id}/records/batch_create |
records (≤500) |
- |
| 🔧 批量更新 |
api |
PUT /bitable/v1/apps/{app_token}/tables/{table_id}/records/batch_update |
records (≤500) |
- |
| 🔧 创建多维表格 |
api |
POST /bitable/v1/apps |
name |
folder_token |
| 🔧 创建数据表 |
api |
POST /bitable/v1/apps/{app_token}/tables |
name |
fields |
调用方式
python3 skills/feishu-cli/run.py '{"action":"tool","module":"bitable","tool_action":"list_records","app_token":"S404b...","table_id":"tbl..."}'
核心约束(Schema 未透露的知识)
详细参考文档
当遇到字段配置、记录值格式问题或需要完整示例时,查阅以下文档:
- 字段 Property 配置详解 — 每种字段类型创建/更新时的
property 参数结构
- 记录值数据结构详解 — 每种字段类型在记录中对应的
fields 值格式
- 使用场景完整示例 — 完整场景示例
何时查阅:
- 创建/更新字段时收到
125408X 错误码 → 查 field-properties.md
- 写入记录时收到
125406X 错误码 → 查 record-values.md
- 需要完整的操作流程和参数示例 → 查 examples.md
字段类型与值格式必须严格匹配
| type |
ui_type |
字段类型 |
正确格式 |
常见错误 |
| 11 |
User |
人员 |
[{id: "ou_xxx"}] |
传字符串或 [{name: "张三"}] |
| 5 |
DateTime |
日期 |
1674206443000(毫秒) |
传秒时间戳或字符串 |
| 3 |
SingleSelect |
单选 |
"选项名" |
传数组 ["选项名"] |
| 4 |
MultiSelect |
多选 |
["选项1", "选项2"] |
传字符串 |
| 15 |
Url |
超链接 |
{link: "...", text: "..."} |
只传字符串 URL |
| 17 |
Attachment |
附件 |
[{file_token: "..."}] |
传外部 URL |
强制流程:
- 先调用
list_fields 获取字段的 type 和 ui_type
- 根据上表或 record-values.md 构造正确格式
- 错误码
125406X 或 1254015 → 检查字段值格式
筛选查询(高级筛选)
filter 参数示例:
{
"conjunction": "and",
"conditions": [
{"field_name": "状态", "operator": "is", "value": ["进行中"]},
{"field_name": "截止日期", "operator": "isLess", "value": ["ExactDate", "1740441600000"]}
]
}
filter operator 列表:
| operator |
含义 |
value 要求 |
is |
等于 |
单个值 |
isNot |
不等于 |
单个值 |
contains |
包含 |
可多个值 |
doesNotContain |
不包含 |
可多个值 |
isEmpty |
为空 |
必须为 [] |
isNotEmpty |
不为空 |
必须为 [] |
isGreater |
大于 |
单个值 |
isLess |
小于 |
单个值 |
日期字段特殊值: ["Today"], ["Tomorrow"], ["ExactDate", "毫秒时间戳"]
常见错误与排查
| 错误码 |
原因 |
解决方案 |
| 1254064 |
日期格式错误 |
必须用毫秒时间戳,不能用字符串或秒时间戳 |
| 1254068 |
超链接格式错误 |
必须用 {text, link} 对象 |
| 1254066 |
人员字段格式错误 |
必须传 [{id: "ou_xxx"}] |
| 1254015 |
字段值与类型不匹配 |
先 list_fields,按类型构造 |
| 1254104 |
批量超 500 条 |
分批调用 |
| 1254291 |
并发写冲突 |
串行调用 + 延迟 0.5-1 秒 |
| 1254045 |
字段名不存在 |
检查字段名(包括空格、大小写) |
资源层级与限制
App (多维表格应用)
├── Table (数据表) ×100
│ ├── Record (记录/行) ×20,000
│ ├── Field (字段/列) ×300
│ └── View (视图) ×200
└── Dashboard (仪表盘)
| 限制项 |
上限 |
| 批量创建/更新/删除 |
500(单次) |
| 单元格文本 |
10 万字符 |
| 单选/多选选项 |
20,000/字段 |
1---2name: feishu-bitable3description: When 飞书多维表格 (Bitable) needs CRUD or management → create/query/edit apps, records, fields, views with advanced filtering and batch ops.4---5
6# Feishu Bitable (多维表格) Skill
7
8## 执行前必读
9
10- **写记录前**:先调用 `field list` 获取字段 type/ui_type,否则格式极易出错
11- **默认表的空行坑**:`app create` 自带的默认表中会有空记录!插入数据前先 `record list` + `record batch_delete` 清空
12- **人员字段**:默认 open_id(ou_...),值必须是 `[{id:"ou_xxx"}]`(数组对象)
13- **日期字段**:毫秒时间戳(例如 `1674206443000`),不是秒
14- **单选字段**:字符串(例如 `"选项1"`),不是数组
15- **多选字段**:字符串数组(例如 `["选项1", "选项2"]`)
16- **附件字段**:必须先上传到当前多维表格,使用返回的 file_token
17- **批量上限**:单次 ≤ 500 条,超过需分批
18- **并发限制**:同一数据表不支持并发写,需串行调用
19
20---
21
22## 快速索引:意图 → 工具调用
23
24> ⚠️ **CLI 支持的动作**(标注 ✅)可直接用 `python3 skills/feishu-cli/run.py` 调用;未标注的需改用 `api` 原始调用。
25
26| 用户意图 | module | tool_action | 必填参数 | 常用可选 |
27|---------|--------|-------------|---------|---------|
28| ✅ 查表有哪些字段 | bitable | list_fields | app_token, table_id | - |
29| ✅ 查记录 | bitable | list_records | app_token, table_id | filter, sort, field_names |
30| ✅ 新增一行 | bitable | create_record | app_token, table_id, fields | - |
31| ✅ 更新一行 | bitable | update_record | app_token, table_id, record_id, fields | - |
32| ✅ 删除记录 | bitable | delete_record | app_token, table_id, record_id | - |
33| ✅ 查看所有表 | bitable | list_tables | app_token | - |
34| 🔧 批量导入 | api | POST /bitable/v1/apps/{app_token}/tables/{table_id}/records/batch_create | records (≤500) | - |
35| 🔧 批量更新 | api | PUT /bitable/v1/apps/{app_token}/tables/{table_id}/records/batch_update | records (≤500) | - |
36| 🔧 创建多维表格 | api | POST /bitable/v1/apps | name | folder_token |
37| 🔧 创建数据表 | api | POST /bitable/v1/apps/{app_token}/tables | name | fields |
38
39### 调用方式
40
41```bash
42python3 skills/feishu-cli/run.py '{"action":"tool","module":"bitable","tool_action":"list_records","app_token":"S404b...","table_id":"tbl..."}'
43```
44
45---
46
47## 核心约束(Schema 未透露的知识)
48
49### 详细参考文档
50
51**当遇到字段配置、记录值格式问题或需要完整示例时,查阅以下文档**:
52
53- **[字段 Property 配置详解](references/field-properties.md)** — 每种字段类型创建/更新时的 `property` 参数结构
54- **[记录值数据结构详解](references/record-values.md)** — 每种字段类型在记录中对应的 `fields` 值格式
55- **[使用场景完整示例](references/examples.md)** — 完整场景示例
56
57**何时查阅**:
58- 创建/更新字段时收到 `125408X` 错误码 → 查 field-properties.md
59- 写入记录时收到 `125406X` 错误码 → 查 record-values.md
60- 需要完整的操作流程和参数示例 → 查 examples.md
61
62---
63
64### 字段类型与值格式必须严格匹配
65
66| type | ui_type | 字段类型 | 正确格式 | 常见错误 |
67|------|---------|----------|---------|----------|
68| 11 | User | 人员 | `[{id: "ou_xxx"}]` | 传字符串或 `[{name: "张三"}]` |
69| 5 | DateTime | 日期 | `1674206443000`(毫秒) | 传秒时间戳或字符串 |
70| 3 | SingleSelect | 单选 | `"选项名"` | 传数组 `["选项名"]` |
71| 4 | MultiSelect | 多选 | `["选项1", "选项2"]` | 传字符串 |
72| 15 | Url | 超链接 | `{link: "...", text: "..."}` | 只传字符串 URL |
73| 17 | Attachment | 附件 | `[{file_token: "..."}]` | 传外部 URL |
74
75**强制流程**:
761. 先调用 `list_fields` 获取字段的 `type` 和 `ui_type`
772. 根据上表或 record-values.md 构造正确格式
783. 错误码 `125406X` 或 `1254015` → 检查字段值格式
79
80---
81
82## 筛选查询(高级筛选)
83
84filter 参数示例:
85
86```json
87{
88 "conjunction": "and",
89 "conditions": [
90 {"field_name": "状态", "operator": "is", "value": ["进行中"]},
91 {"field_name": "截止日期", "operator": "isLess", "value": ["ExactDate", "1740441600000"]}
92 ]
93}
94```
95
96**filter operator 列表**:
97
98| operator | 含义 | value 要求 |
99|----------|------|-----------|
100| `is` | 等于 | 单个值 |
101| `isNot` | 不等于 | 单个值 |
102| `contains` | 包含 | 可多个值 |
103| `doesNotContain` | 不包含 | 可多个值 |
104| `isEmpty` | 为空 | **必须为 `[]`** |
105| `isNotEmpty` | 不为空 | **必须为 `[]`** |
106| `isGreater` | 大于 | 单个值 |
107| `isLess` | 小于 | 单个值 |
108
109**日期字段特殊值**: `["Today"]`, `["Tomorrow"]`, `["ExactDate", "毫秒时间戳"]`
110
111---
112
113## 常见错误与排查
114
115| 错误码 | 原因 | 解决方案 |
116|--------|------|---------|
117| 1254064 | 日期格式错误 | 必须用毫秒时间戳,不能用字符串或秒时间戳 |
118| 1254068 | 超链接格式错误 | 必须用 `{text, link}` 对象 |
119| 1254066 | 人员字段格式错误 | 必须传 `[{id: "ou_xxx"}]` |
120| 1254015 | 字段值与类型不匹配 | 先 list_fields,按类型构造 |
121| 1254104 | 批量超 500 条 | 分批调用 |
122| 1254291 | 并发写冲突 | 串行调用 + 延迟 0.5-1 秒 |
123| 1254045 | 字段名不存在 | 检查字段名(包括空格、大小写) |
124
125---
126
127## 资源层级与限制
128
129```
130App (多维表格应用)
131 ├── Table (数据表) ×100
132 │ ├── Record (记录/行) ×20,000
133 │ ├── Field (字段/列) ×300
134 │ └── View (视图) ×200
135 └── Dashboard (仪表盘)
136```
137
138| 限制项 | 上限 |
139|--------|------|
140| 批量创建/更新/删除 | 500(单次) |
141| 单元格文本 | 10 万字符 |
142| 单选/多选选项 | 20,000/字段 |