diff --git a/extensions/feishu/src/bitable.ts b/extensions/feishu/src/bitable.ts index e7d027694d1..0e286e6776a 100644 --- a/extensions/feishu/src/bitable.ts +++ b/extensions/feishu/src/bitable.ts @@ -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",