delete_form_data
Remove specific or multiple form data entries in JianDaoYun MCP Server by specifying app ID, form ID, and data IDs. Supports optional automation triggering for streamlined workflows.
Instructions
Delete one or more form data entries
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| appId | Yes | The JianDaoYun application ID | |
| appKey | No | The JianDaoYun application key (API key) (optional, will use JIANDAOYUN_APP_KEY from environment if not provided) | |
| dataIds | Yes | Data ID(s) to delete | |
| formId | Yes | The form ID (can be form ID or app ID) | |
| isStartTrigger | No | Whether to trigger automation |
Implementation Reference
- src/index.ts:858-904 (handler)MCP tool handler that processes the delete_form_data tool call: validates inputs, resolves form ID, invokes the client method, formats and returns the response or error.case 'delete_form_data': { const { formId, dataIds, isStartTrigger } = args as { formId: string; dataIds: string | string[]; isStartTrigger?: boolean; }; const { appId, appKey, baseUrl } = getDefaultParams(args); // 验证必需参数 if (!appKey) { throw new Error('appKey is required. Please set JIANDAOYUN_APP_KEY in MCP server configuration.'); } if (!appId) { throw new Error('appId is required. Please provide it as parameter.'); } try { // 创建客户端实例 const jdyClient = new JianDaoYunClient({ appId, appKey, baseUrl }); const resolved = await resolveFormId(formId, appKey); const result = await jdyClient.deleteFormData(resolved.formId, dataIds, { isStartTrigger, }); return { content: [ { type: 'text', text: JSON.stringify({ success: true, result, message: `成功删除 ${Array.isArray(dataIds) ? dataIds.length : 1} 条记录`, formUsed: resolved.formId, appId: resolved.appId || appId }, null, 2), }, ], }; } catch (error) { throw createEnhancedError(error, '删除表单数据'); } }
- src/index.ts:432-461 (schema)Tool definition including name, description, and input schema for validation.name: 'delete_form_data', description: 'Delete one or more form data entries', inputSchema: { type: 'object', properties: { appId: { type: 'string', description: 'The JianDaoYun application ID', }, appKey: { type: 'string', description: 'The JianDaoYun application key (API key) (optional, will use JIANDAOYUN_APP_KEY from environment if not provided)', }, formId: { type: 'string', description: 'The form ID (can be form ID or app ID)', }, dataIds: { type: ['string', 'array'], description: 'Data ID(s) to delete', items: { type: 'string' }, }, isStartTrigger: { type: 'boolean', description: 'Whether to trigger automation', }, }, required: ['appId', 'formId', 'dataIds'], }, },
- src/index.ts:506-507 (registration)The tools array registration where delete_form_data is included in server.setTools.], };
- src/client.ts:296-329 (helper)JianDaoYunClient method implementing the delete API call, handling single or batch deletion via appropriate endpoints.async deleteFormData(formId: string, dataId: string | string[], options?: { isStartTrigger?: boolean }): Promise<any> { try { const isMultiple = Array.isArray(dataId); const endpoint = isMultiple ? '/v5/app/entry/data/batch_delete' : '/v5/app/entry/data/delete'; const requestData: any = { app_id: this.config.appId, entry_id: formId }; if (isMultiple) { requestData.data_ids = dataId; } else { requestData.data_id = dataId; } if (options?.isStartTrigger !== undefined) { requestData.is_start_trigger = options.isStartTrigger; } const response = await this.axios.post<ApiResponse>(endpoint, requestData); if (response.data.code !== 0) { throw new Error(`Failed to delete form data: ${response.data.msg}`); } return response.data.data; } catch (error) { if (axios.isAxiosError(error)) { throw new Error(`API request failed: ${error.response?.data?.msg || error.message}`); } throw error; } }