Skip to main content
Glama
bit2beat

Bitrix24 MCP server

b24_compare_configs

Compare two Bitrix24 JSON configuration files to identify differences. Find what exists in the source but not in the destination, and vice versa.

Instructions

Compara dos archivos JSON de configuración e informa qué existe en origen y no en destino, y viceversa.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
source_fileYesRuta al archivo JSON de configuración origen
dest_fileYesRuta al archivo JSON de configuración destino

Implementation Reference

  • index.js:162-164 (registration)
    Registration of the 'b24_compare_configs' tool on the MCP server with its schema and handler.
    server.tool('b24_compare_configs',
      'Compara dos archivos JSON de configuración e informa qué existe en origen y no en destino, y viceversa.',
      compareConfigsSchema.shape, wrap(compareConfigs));
  • Zod schema defining the two input parameters: source_file and dest_file (both strings with file paths).
    export const compareConfigsSchema = z.object({
      source_file: z.string().describe('Ruta al archivo JSON de configuración origen'),
      dest_file: z.string().describe('Ruta al archivo JSON de configuración destino'),
    });
  • Main handler function that reads two JSON config files, compares them across entity types, pipelines, custom fields, currencies, and automations, then returns a diff report.
    export async function compareConfigs({ source_file, dest_file }) {
      const source = JSON.parse(readFileSync(source_file, 'utf-8'));
      const dest = JSON.parse(readFileSync(dest_file, 'utf-8'));
    
      const report = {
        source_portal: source.meta?.portal,
        dest_portal: dest.meta?.portal,
        source_exported_at: source.meta?.exported_at,
        dest_exported_at: dest.meta?.exported_at,
        differences: {},
      };
    
      // Entity types SPA
      report.differences.spa_types = diffArrayByName(
        source.entity_types?.spa,
        dest.entity_types?.spa
      );
    
      // Pipelines
      const srcPipelineNames = Object.values(source.pipelines || {}).map(p => p.NAME);
      const dstPipelineNames = Object.values(dest.pipelines || {}).map(p => p.NAME);
      report.differences.pipelines = diffArrayByName(
        srcPipelineNames.map(n => ({ NAME: n })),
        dstPipelineNames.map(n => ({ NAME: n }))
      );
    
      // Custom fields por entidad
      report.differences.custom_fields = {};
      const entities = new Set([
        ...Object.keys(source.custom_fields || {}),
        ...Object.keys(dest.custom_fields || {}),
      ]);
      for (const entity of entities) {
        report.differences.custom_fields[entity] = diffArrayByName(
          source.custom_fields?.[entity] || [],
          dest.custom_fields?.[entity] || [],
          'FIELD_NAME'
        );
      }
    
      // Currencies
      report.differences.currencies = diffArrayByName(
        source.currencies || [],
        dest.currencies || [],
        'CURRENCY'
      );
    
      // Automations
      const srcAutoStages = Object.keys(source.automations || {});
      const dstAutoStages = Object.keys(dest.automations || {});
      report.differences.automation_stages = {
        only_in_source: srcAutoStages.filter(s => !dstAutoStages.includes(s)),
        only_in_dest: dstAutoStages.filter(s => !srcAutoStages.includes(s)),
        in_both: srcAutoStages.filter(s => dstAutoStages.includes(s)),
      };
    
      // Summary
      const hasDiffs = Object.values(report.differences).some(d => {
        if (d.only_in_source?.length || d.only_in_dest?.length) return true;
        if (typeof d === 'object') {
          return Object.values(d).some(sub => sub?.only_in_source?.length || sub?.only_in_dest?.length);
        }
        return false;
      });
    
      report.has_differences = hasDiffs;
      report.summary = hasDiffs
        ? 'Se encontraron diferencias entre las configuraciones. Revisar el informe antes de aplicar.'
        : 'Las configuraciones son equivalentes en estructura.';
    
      return report;
    }
  • Helper function that diffs two arrays of objects by a name key (default 'NAME'), returning only_in_source, only_in_dest, and in_both sets.
    function diffArrayByName(srcArr, dstArr, nameKey = 'NAME') {
      const srcNames = new Set((srcArr || []).map(i => i[nameKey]));
      const dstNames = new Set((dstArr || []).map(i => i[nameKey]));
      return {
        only_in_source: [...srcNames].filter(n => !dstNames.has(n)),
        only_in_dest: [...dstNames].filter(n => !srcNames.has(n)),
        in_both: [...srcNames].filter(n => dstNames.has(n)),
      };
    }
  • index.js:26-26 (registration)
    Import statement bringing in the schema and handler for the compareConfigs tool.
    import { compareConfigsSchema, compareConfigs } from './src/tools/compare-configs.js';
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must carry the full burden. It discloses the basic behavior (comparison and reporting differences) but lacks details like whether the comparison is deep, what happens with invalid JSON, or the output format. Important behavioral traits are missing.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence that conveys the core functionality with no wasted words. It is front-loaded with the verb and resource.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple two-parameter tool with no output schema, the description covers the main purpose and output. However, it omits error handling, expected input validity, and the report's structure, leaving gaps for an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% with clear descriptions for both parameters. The tool description does not add additional semantics beyond what the schema already provides, so baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('compara dos archivos JSON de configuración') and the result ('informa qué existe en origen y no en destino, y viceversa'), with a specific verb and resource. It distinguishes from sibling tools like b24_read_full_config and b24_apply_config.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for comparing configuration files but does not explicitly state when to use it versus alternatives or when not to use it. No exclusions or prerequisites are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bit2beat/bitrix24-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server