update_form_data
Modify existing form entries in JianDaoYun applications by providing the form ID, entry ID, and updated data values.
Instructions
Update an existing form data entry
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"appId": "<appId>",
"formId": "<formId>",
"dataId": "<dataId>",
"data": "<data>"
},
"name": "update_form_data"
}
}Input 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) | |
| formId | Yes | The form ID (can be form ID or app ID) | |
| dataId | Yes | The data entry ID to update | |
| data | Yes | The data to update | |
| transactionId | No | Optional transaction ID | |
| isStartTrigger | No | Whether to trigger automation |
Implementation Reference
- src/index.ts:393-430 (registration)Registration of the 'update_form_data' tool including its input schema definition
{ name: 'update_form_data', description: 'Update an existing form data entry', 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)', }, dataId: { type: 'string', description: 'The data entry ID to update', }, data: { type: 'object', description: 'The data to update', }, transactionId: { type: 'string', description: 'Optional transaction ID', }, isStartTrigger: { type: 'boolean', description: 'Whether to trigger automation', }, }, required: ['appId', 'formId', 'dataId', 'data'], }, }, - src/index.ts:807-856 (handler)MCP dispatch handler for 'update_form_data': validates params, resolves form ID, creates JianDaoYunClient, calls updateFormData, returns result
case 'update_form_data': { const { formId, dataId, data, transactionId, isStartTrigger } = args as { formId: string; dataId: string; data: FormData; transactionId?: 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.updateFormData(resolved.formId, dataId, data, { transactionId, isStartTrigger, }); return { content: [ { type: 'text', text: JSON.stringify({ success: true, result, message: '数据更新成功', formUsed: resolved.formId, appId: resolved.appId || appId }, null, 2), }, ], }; } catch (error) { throw createEnhancedError(error, '更新表单数据'); } } - src/client.ts:264-294 (handler)Core API client method: formats the update data using formatDataForSubmission and performs POST request to JianDaoYun /v5/app/entry/data/update endpoint
async updateFormData(formId: string, dataId: string, data: FormData, options?: { transactionId?: string; isStartTrigger?: boolean }): Promise<any> { try { const requestData: any = { app_id: this.config.appId, entry_id: formId, data_id: dataId, data: this.formatDataForSubmission(data) }; if (options?.transactionId) { requestData.transaction_id = options.transactionId; } if (options?.isStartTrigger !== undefined) { requestData.is_start_trigger = options.isStartTrigger; } const response = await this.axios.post<ApiResponse>('/v5/app/entry/data/update', requestData); if (response.data.code !== 0) { throw new Error(`Failed to update 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; } }