b24_tasks_get
Retrieve full task details from Bitrix24 by task ID. Get all task metadata and specified fields.
Instructions
Obtiene el detalle completo de una tarea por ID.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID de la tarea | |
| select | No | Campos a retornar | |
| webhook_url | No |
Implementation Reference
- src/tools/tasks.js:49-54 (handler)The main handler function for the b24_tasks_get tool. Creates a Bitrix24Client, calls tasks.task.get with the task ID and optional select fields, and returns the task details.
export async function tasksGet({ id, select, webhook_url }) { const client = new Bitrix24Client(resolveWebhook(webhook_url)); const params = { taskId: id, ...(select ? { select } : {}) }; const res = await client.call('tasks.task.get', params); return { portal: client.portal, task: res.result?.task ?? res.result }; } - src/tools/tasks.js:43-47 (schema)Zod schema for b24_tasks_get: validates id (string|number required), select (optional array of strings), and webhook_url (optional URL).
export const tasksGetSchema = z.object({ id: z.union([z.string(), z.number()]).describe('ID de la tarea'), select: z.array(z.string()).optional().describe('Campos a retornar'), webhook_url: z.string().url().optional(), }); - index.js:179-181 (registration)Registration of the 'b24_tasks_get' tool on the MCP server with its description, schema, and wrapped handler.
server.tool('b24_tasks_get', 'Obtiene el detalle completo de una tarea por ID.', tasksGetSchema.shape, wrap(tasksGet)); - src/utils/resolve-webhook.js:1-10 (helper)Resolves the webhook URL from the parameter or falls back to environment variable B24_DEFAULT_WEBHOOK.
export function resolveWebhook(webhookParam) { const url = webhookParam || process.env.B24_DEFAULT_WEBHOOK; if (!url) { throw new Error( 'No se especificó webhook_url y no hay B24_DEFAULT_WEBHOOK configurado. ' + 'Indicá el webhook en el parámetro webhook_url o configuralo en el servidor MCP.' ); } return url; } - src/bitrix24/client.js:21-40 (helper)Bitrix24Client.call() - makes API calls to the Bitrix24 REST API with retry logic for rate limiting and timeouts.
async call(method, params = {}, retries = 0) { return this.limiter.schedule(async () => { try { const url = `${this.webhookUrl}${method}.json`; const response = await axios.post(url, params, { timeout: 30000 }); if (response.data.error) { throw new Error(`Bitrix24 error [${response.data.error}]: ${response.data.error_description}`); } return response.data; } catch (err) { if (err.response?.status === 429 && retries < MAX_RETRIES) { const retryAfter = parseInt(err.response.headers['retry-after'] || '2', 10); await new Promise(r => setTimeout(r, retryAfter * 1000)); return this.call(method, params, retries + 1); } if (err.code === 'ECONNABORTED' && retries < MAX_RETRIES) { const backoff = Math.pow(2, retries) * 1000; await new Promise(r => setTimeout(r, backoff)); return this.call(method, params, retries + 1); }