diff --git a/extensions/feishu/src/bitable.ts b/extensions/feishu/src/bitable.ts index 451839edb1f..3919ee7478e 100644 --- a/extensions/feishu/src/bitable.ts +++ b/extensions/feishu/src/bitable.ts @@ -438,6 +438,23 @@ 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 +547,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 +709,27 @@ 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: + "Permanently delete a record (row) from a Bitable table. This action is irreversible.", + 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",