Skip to main content
Glama
bit2beat

Bitrix24 MCP server

b24_save_user_mapping

Map user IDs between source and destination Bitrix24 instances for replicating automations. Saves the mapping to a JSON file at a specified path.

Instructions

Genera y guarda el mapeo de IDs de usuarios entre dos instancias, necesario para replicar automatizaciones.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
source_usersYesLista de usuarios de la instancia origen
dest_usersYesLista de usuarios de la instancia destino
output_fileYesRuta donde guardar el JSON de mapeo

Implementation Reference

  • index.js:170-172 (registration)
    Registration of the 'b24_save_user_mapping' tool on the MCP server with its schema and handler.
    server.tool('b24_save_user_mapping',
      'Genera y guarda el mapeo de IDs de usuarios entre dos instancias, necesario para replicar automatizaciones.',
      saveUserMappingSchema.shape, wrap(saveUserMappingTool));
  • Main handler function 'saveUserMappingTool' that uses suggestUserMapping to match source users to destination users and saves the mapping to a file.
    export async function saveUserMappingTool({ source_users, dest_users, output_file }) {
      const mapping = suggestUserMapping(source_users, dest_users);
    
      const unmapped = source_users.filter(u => !mapping[u.ID]);
    
      saveUserMapping(mapping, output_file);
    
      return {
        saved_to: output_file,
        mapped_count: Object.keys(mapping).length,
        unmapped_count: unmapped.length,
        mapping,
        unmapped_users: unmapped.map(u => ({
          id: u.ID,
          name: `${u.NAME || ''} ${u.LAST_NAME || ''}`.trim(),
          email: u.EMAIL,
        })),
        summary: `${Object.keys(mapping).length} usuarios mapeados, ${unmapped.length} sin correspondencia en destino`,
        note: unmapped.length > 0
          ? 'Los usuarios sin mapeo deberán asignarse manualmente. Las automatizaciones que los referencien tendrán advertencias al aplicar.'
          : null,
      };
    }
  • Zod schema 'saveUserMappingSchema' defining the input validation: source_users array, dest_users array, and output_file string.
    export const saveUserMappingSchema = z.object({
      source_users: z.array(z.object({
        ID: z.string(),
        NAME: z.string().optional(),
        LAST_NAME: z.string().optional(),
        EMAIL: z.string().optional(),
      })).describe('Lista de usuarios de la instancia origen'),
      dest_users: z.array(z.object({
        ID: z.string(),
        NAME: z.string().optional(),
        LAST_NAME: z.string().optional(),
        EMAIL: z.string().optional(),
      })).describe('Lista de usuarios de la instancia destino'),
      output_file: z.string().describe('Ruta donde guardar el JSON de mapeo'),
    });
  • Helper function 'suggestUserMapping' that matches users by email first, then by full name, creating a mapping from source ID to dest ID.
    export function suggestUserMapping(sourceUsers, destUsers) {
      const mapping = {};
      for (const src of sourceUsers) {
        const match =
          destUsers.find(d => d.EMAIL === src.EMAIL) ||
          destUsers.find(d => `${d.NAME} ${d.LAST_NAME}`.trim() === `${src.NAME} ${src.LAST_NAME}`.trim());
        if (match) {
          mapping[src.ID] = match.ID;
        }
      }
      return mapping;
    }
  • Helper function 'saveUserMapping' that writes the mapping JSON object to a file.
    export function saveUserMapping(mapping, outputFile) {
      writeFileSync(outputFile, JSON.stringify(mapping, null, 2), 'utf-8');
    }
Behavior2/5

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

No annotations are provided, and the description does not disclose behavioral traits beyond the basic action. It does not mention whether the output file is overwritten, what happens if the mapping already exists, authentication requirements, or rate limits.

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 of 13 words, efficiently conveying the core purpose without unnecessary verbose. It is front-loaded with the action.

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

Completeness4/5

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

Given the simple three-parameter schema and no output schema, the description adequately explains the tool's purpose. It does not detail the output format, but the parameter 'output_file' hints at a JSON file. Sibling tools provide context for automation replication.

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 coverage is 100%, and the description adds no additional meaning beyond the parameter descriptions already in the schema. It correctly implies that the mapping is based on user IDs, which aligns with the 'ID' required field.

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 ('generates and saves'), the resource ('user ID mapping between two instances'), and its purpose ('necessary to replicate automations'). This distinguishes it from sibling tools that focus on CRM, tasks, disk, etc.

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 provides context by stating it is necessary for replicating automations, implying its use in that workflow. However, it does not give explicit guidance on when to use this tool versus alternatives, nor does it mention when not to use it.

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