b24_read_full_config
Export all Bitrix24 structural configuration including entities, pipelines, stages, fields, automations, catalog, and users to a JSON file.
Instructions
Lee TODA la configuración estructural de la instancia: entidades, pipelines, etapas, campos, automatizaciones, catálogo y usuarios. Exporta a JSON.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| webhook_url | No | URL del webhook (opcional si está configurado por defecto) | |
| output_file | No | Ruta donde guardar el JSON exportado | |
| verbose | No |
Implementation Reference
- src/tools/read-config.js:14-64 (handler)Main handler function that reads full configuration by fetching entity types, pipelines, custom fields, automations, product catalog, and users in parallel, then exports them to a JSON file and returns a summary.
export async function readFullConfig({ webhook_url, output_file, verbose = false }) { const client = new Bitrix24Client(resolveWebhook(webhook_url)); const reader = new Bitrix24Reader(client); const [entityData, pipelines, customFields, automations, productCatalog, users] = await Promise.all([ reader.readEntityTypes(), reader.readPipelines(), reader.readCustomFields(), reader.readAutomations(), reader.readProductCatalog(), reader.readUsers(), ]); const config = { meta: { exported_at: new Date().toISOString(), portal: client.portal, mcp_version: '1.0.0', }, entity_types: { standard: entityData.standard, spa: entityData.spa, }, pipelines, custom_fields: customFields, automations, product_catalog: productCatalog, statuses: entityData.statuses, currencies: entityData.currencies, users, }; const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19); const defaultFile = join(process.cwd(), `config_${client.portal}_${timestamp}.json`); const filePath = output_file || defaultFile; writeFileSync(filePath, JSON.stringify(config, null, 2), 'utf-8'); const summary = { portal: client.portal, saved_to: filePath, entity_types: `${entityData.standard.length} estándar + ${entityData.spa.length} SPA`, pipelines: Object.keys(pipelines).length, custom_fields: Object.values(customFields).reduce((a, f) => a + f.length, 0), automations: Object.values(automations).reduce((a, r) => a + r.length, 0), users: users.length, currencies: entityData.currencies.length, }; return verbose ? { ...summary, config } : summary; } - src/tools/read-config.js:8-12 (schema)Zod schema defining the input parameters for the tool: webhook_url (optional), output_file (optional), verbose (optional boolean).
export const readConfigSchema = z.object({ webhook_url: z.string().url().optional().describe('URL del webhook (opcional si está configurado por defecto)'), output_file: z.string().optional().describe('Ruta donde guardar el JSON exportado'), verbose: z.boolean().optional().default(false), }); - index.js:138-140 (registration)Registration of the 'b24_read_full_config' tool on the MCP server with its name, description, schema, and handler.
server.tool('b24_read_full_config', 'Lee TODA la configuración estructural de la instancia: entidades, pipelines, etapas, campos, automatizaciones, catálogo y usuarios. Exporta a JSON.', readConfigSchema.shape, wrap(readFullConfig)); - index.js:6-20 (helper)Import of readConfigSchema and readFullConfig from the read-config module into the main entry point.
// ── CRM Datos ───────────────────────────────────────────────────────────────── import { crmListSchema, crmList, crmGetSchema, crmGet, crmCreateSchema, crmCreate, crmUpdateSchema, crmUpdate, crmDeleteSchema, crmDelete, crmFieldsSchema, crmFields, timelineAddSchema, timelineAdd, } from './src/tools/crm.js'; // ── CRM Config ──────────────────────────────────────────────────────────────── import { connectTestSchema, connectTest } from './src/tools/connect-test.js'; import { readConfigSchema, readFullConfig } from './src/tools/read-config.js';