feat(feishu): add delete_record tool for bitable

This commit is contained in:
Alec 2026-03-09 14:36:48 +08:00
parent e2a1a4a3db
commit 9ebd5fefd6

View File

@ -438,6 +438,18 @@ async function updateRecord(
};
}
async function deleteRecord(client: Lark.Client, appToken: string, tableId: string, recordId: string) {
const res = await client.bitable.appTableRecord.delete({
path: { app_token: appToken, table_id: tableId, record_id: recordId },
});
ensureLarkSuccess(res, "bitable.appTableRecord.delete", { appToken, tableId, recordId });
return {
deleted: true,
record_id: recordId,
};
}
// ============ Schemas ============
const GetMetaSchema = Type.Object({
@ -530,6 +542,14 @@ const UpdateRecordSchema = Type.Object({
}),
});
const DeleteRecordSchema = Type.Object({
app_token: Type.String({
description: "Bitable app token (use feishu_bitable_get_meta to get from URL)",
}),
table_id: Type.String({ description: "Table ID (from URL: ?table=YYY)" }),
record_id: Type.String({ description: "Record ID to delete" }),
});
// ============ Tool Registration ============
export function registerFeishuBitableTools(api: OpenClawPluginApi) {
@ -684,6 +704,26 @@ export function registerFeishuBitableTools(api: OpenClawPluginApi) {
},
});
registerBitableTool<{
app_token: string;
table_id: string;
record_id: string;
accountId?: string;
}>({
name: "feishu_bitable_delete_record",
label: "Feishu Bitable Delete Record",
description: "Delete a record (row) from a Bitable table",
parameters: DeleteRecordSchema,
async execute({ params, defaultAccountId }) {
return deleteRecord(
getClient(params, defaultAccountId),
params.app_token,
params.table_id,
params.record_id,
);
},
});
registerBitableTool<{ name: string; folder_token?: string; accountId?: string }>({
name: "feishu_bitable_create_app",
label: "Feishu Bitable Create App",