b24_test_connection
Verify connection to Bitrix24 webhook and confirm portal details and user permissions.
Instructions
Verifica la conexión al webhook de Bitrix24 y confirma datos del portal y permisos del usuario.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| webhook_url | No | URL del webhook de Bitrix24 (opcional si está configurado por defecto) |
Implementation Reference
- src/tools/connect-test.js:9-32 (handler)The connectTest async function that executes the tool logic: creates a Bitrix24Client, calls app.info and profile APIs, and returns portal/user info with admin check.
export async function connectTest({ webhook_url }) { const client = new Bitrix24Client(resolveWebhook(webhook_url)); const [appInfo, currentUser] = await Promise.all([ client.call('app.info'), client.call('profile'), ]); const profile = currentUser.result; const isAdmin = profile?.ADMIN === true || profile?.ADMIN === 'Y'; return { success: true, portal: client.portal, app_info: appInfo.result, user: { id: profile?.ID, name: `${profile?.NAME} ${profile?.LAST_NAME}`.trim(), email: profile?.EMAIL, is_admin: isAdmin, }, warning: isAdmin ? null : 'El usuario del webhook no tiene rol de Administrador. Algunas operaciones pueden fallar.', }; } - src/tools/connect-test.js:5-7 (schema)Zod schema for the tool's input: optional webhook_url string.
export const connectTestSchema = z.object({ webhook_url: z.string().url().optional().describe('URL del webhook de Bitrix24 (opcional si está configurado por defecto)'), }); - index.js:104-106 (registration)Registration of the 'b24_test_connection' tool on the MCP server with description, schema, and handler wrapper.
server.tool('b24_test_connection', 'Verifica la conexión al webhook de Bitrix24 y confirma datos del portal y permisos del usuario.', connectTestSchema.shape, wrap(connectTest)); - src/utils/resolve-webhook.js:1-15 (helper)resolveWebhook helper function that resolves the webhook URL from parameter or 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; }