Skip to main content
Glama
bit2beat

Bitrix24 MCP server

b24_read_automations

Reads automation rules by stage, listing robots and triggers with their conditions and actions.

Instructions

Lee reglas de automatización (robots y triggers) por etapa con condiciones y acciones.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
webhook_urlNoURL del webhook (opcional si está configurado por defecto)
entity_type_idNoID del tipo de entidad (opcional)

Implementation Reference

  • Main handler function that creates a Bitrix24 client, calls reader.readAutomations(), and returns the automation rules grouped by stage.
    export async function readAutomations({ webhook_url, entity_type_id }) {
      const client = new Bitrix24Client(resolveWebhook(webhook_url));
      const reader = new Bitrix24Reader(client);
      const automations = await reader.readAutomations(entity_type_id);
    
      const totalRules = Object.values(automations).reduce((acc, rules) => acc + rules.length, 0);
    
      return {
        portal: client.portal,
        automations,
        stages_with_automations: Object.keys(automations).length,
        total_rules: totalRules,
        summary: `${totalRules} reglas de automatización en ${Object.keys(automations).length} etapas`,
        note: 'Las automatizaciones referencian usuarios por ID. Usar b24_read_users y b24_save_user_mapping antes de aplicar en otra instancia.',
      };
    }
  • Zod schema defining optional webhook_url and entity_type_id parameters for the tool.
    export const readAutomationsSchema = z.object({
      webhook_url: z.string().url().optional().describe('URL del webhook (opcional si está configurado por defecto)'),
      entity_type_id: z.number().int().optional().describe('ID del tipo de entidad (opcional)'),
    });
  • Reader method that fetches automation rules via 'crm.automation.rule.list' API, grouping them by ENTITY_TYPE_ID:STAGE_ID.
    async readAutomations(entityTypeId = null) {
      const automations = {};
      try {
        const rules = await fetchAllPages(this.client, 'crm.automation.rule.list', {
          filter: entityTypeId ? { ENTITY_TYPE_ID: entityTypeId } : {},
        });
        for (const rule of rules) {
          const key = `${rule.ENTITY_TYPE_ID}:${rule.STAGE_ID}`;
          if (!automations[key]) automations[key] = [];
          automations[key].push(rule);
        }
      } catch {
        // bizproc scope may not be available
      }
      return automations;
    }
  • index.js:24-24 (registration)
    Import of readAutomationsSchema and readAutomations from the tool module.
    import { readAutomationsSchema, readAutomations } from './src/tools/read-automations.js';
  • index.js:154-156 (registration)
    Registration of 'b24_read_automations' tool on the MCP server with its schema and handler.
    server.tool('b24_read_automations',
      'Lee reglas de automatización (robots y triggers) por etapa con condiciones y acciones.',
      readAutomationsSchema.shape, wrap(readAutomations));
Behavior2/5

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

No annotations are present, and the description only says 'read' (Lee). It does not confirm the operation is safe (read-only), does not disclose any rate limits, authentication needs, or side effects. The tool name implies read-only, but the description adds no behavioral context beyond that.

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

Conciseness4/5

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

The description is a single concise sentence (12 words in Spanish) with no fluff. It could be slightly more structured (e.g., listing what is read), but it is appropriately sized for a simple read tool.

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?

Given no output schema, the description partially explains the return (automation rules with conditions and actions) but does not specify the format or structure. For a tool with only two optional parameters and a clear read purpose, the description is adequate but lacks completeness about output and distinct use cases among sibling tools.

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% with both parameters described. The description adds the context of reading 'by stage', which hints that entity_type_id might relate to a stage, but does not explicitly map parameters. It adds marginal meaning beyond the schema's descriptions.

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 tool reads automation rules (robots and triggers) by stage with conditions and actions. It uses a specific verb ('Lee') and resource, and distinguishes from sibling b24_read_* tools such as b24_read_custom_fields or b24_read_pipelines.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives like b24_read_full_config or b24_read_pipelines. The description does not mention prerequisites, typical scenarios, or exclusions.

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