b24_tasks_update
Updates specified fields of an existing Bitrix24 task. Requires task ID and field data.
Instructions
Actualiza campos de una tarea existente.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| fields | Yes | Campos a actualizar | |
| webhook_url | No |
Implementation Reference
- src/tools/tasks.js:81-85 (handler)The core handler function that executes the 'b24_tasks_update' tool logic. It calls the Bitrix24 REST API 'tasks.task.update' with the task ID and fields, returning success.
export async function tasksUpdate({ id, fields, webhook_url }) { const client = new Bitrix24Client(resolveWebhook(webhook_url)); await client.call('tasks.task.update', { taskId: id, fields }); return { portal: client.portal, updated_id: id, success: true }; } - src/tools/tasks.js:75-79 (schema)Zod schema defining the input validation for the tool: id (string|number), fields (record of any), and optional webhook_url.
export const tasksUpdateSchema = z.object({ id: z.union([z.string(), z.number()]), fields: z.record(z.any()).describe('Campos a actualizar'), webhook_url: z.string().url().optional(), }); - index.js:187-189 (registration)Registers the tool with the MCP server using server.tool() with the name 'b24_tasks_update', description, schema, and wrapped handler.
server.tool('b24_tasks_update', 'Actualiza campos de una tarea existente.', tasksUpdateSchema.shape, wrap(tasksUpdate)); - index.js:78-90 (helper)The 'wrap' function that wraps the handler to serialize its result as JSON text content and catch errors.
function wrap(fn) { return async (params) => { try { const result = await fn(params); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } catch (err) { const msg = err.response?.data ? `${err.message}\nBitrix24: ${JSON.stringify(err.response.data)}` : err.message; return { content: [{ type: 'text', text: `Error: ${msg}` }], isError: true }; } }; } - index.js:35-35 (registration)Import statement that brings in tasksUpdateSchema and tasksUpdate from src/tools/tasks.js.
tasksUpdateSchema, tasksUpdate,