Skip to main content
Glama
Catter58

mcpBPMSoft

by Catter58

Установить статус записи

bpm_set_status
Idempotent

Set a record's status using a human-readable status name. The server automatically identifies the correct status field and resolves the status UUID.

Instructions

Установить статус записи по человекочитаемому имени. Сервер сам найдёт поле-статус в коллекции (StatusId/StageId) и разрешит UUID статуса в его справочнике.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionYesИмя коллекции (EntitySet), например: Opportunity, Lead, Activity
idYesUUID записи, у которой меняется статус
statusYesЧеловекочитаемое имя статуса (Name справочника)
status_fieldNoЯвное имя поля-статуса (если в коллекции несколько кандидатов: StatusId, StageId и т.п.)

Implementation Reference

  • Registers the bpm_set_status tool on the MCP server. The handler: (1) resolves the collection reference, (2) auto-detects a status lookup field (by checking property names containing Status/Stage/State), or uses an explicit status_field parameter, (3) resolves the human-readable status name via lookup resolver, (4) updates the record via OData, and (5) returns a success message with structured data.
    export function registerSetStatusTool(server: McpServer, services: ServiceContainer): void {
      const meta = getTool('bpm_set_status');
      server.registerTool(
        meta.name,
        {
          title: meta.title,
          description: meta.description,
          inputSchema: {
            collection: z.string().describe('Имя коллекции (EntitySet), например: Opportunity, Lead, Activity'),
            id: z.string().describe('UUID записи, у которой меняется статус'),
            status: z.string().describe('Человекочитаемое имя статуса (Name справочника)'),
            status_field: z
              .string()
              .optional()
              .describe(
                'Явное имя поля-статуса (если в коллекции несколько кандидатов: StatusId, StageId и т.п.)'
              ),
          },
          annotations: meta.annotations,
        },
        async (params): Promise<CallToolResult> => {
          if (!services.initialized) return notInitialized();
          try {
            await services.authManager.ensureAuthenticated();
    
            const collRef = await services.metadataManager.resolveCollectionReference(params.collection);
            if (collRef.name === null) {
              throw new UnknownCollectionError(params.collection, collRef.suggestions);
            }
            const collection = collRef.name;
    
            const entityMeta = await services.metadataManager.getEntityMetadata(collection);
    
            let statusField: EntityProperty | undefined;
            if (params.status_field) {
              const ref = await services.metadataManager.resolveFieldReference(collection, params.status_field);
              if (ref.name === null) {
                throw new BpmApiError(
                  `Поле "${params.status_field}" не найдено в коллекции ${collection}`,
                  400,
                  collection,
                  undefined,
                  ref.suggestions
                );
              }
              statusField = entityMeta.properties.find((p) => p.name === ref.name);
            } else {
              const candidates = entityMeta.properties.filter(
                (p) => p.isLookup && isStatusFieldName(p.name)
              );
              if (candidates.length === 0) {
                throw new BpmApiError(
                  `В коллекции ${collection} не найдено lookup-поле статуса (имя содержит Status/Stage/State).`,
                  400,
                  collection,
                  undefined,
                  undefined,
                  [
                    `Запросите схему: bpm_get_schema(${collection}).`,
                    `Или передайте имя поля явно через status_field.`,
                  ]
                );
              }
              if (candidates.length > 1) {
                throw new BpmApiError(
                  `Найдено несколько статусных полей: ${candidates.map((c) => c.name).join(', ')}. Передайте status_field явно.`,
                  400,
                  collection,
                  undefined,
                  candidates.map((c) => c.name),
                  [`Повторите вызов, добавив параметр status_field='<нужное имя>'.`]
                );
              }
              statusField = candidates[0];
            }
    
            if (!statusField) {
              throw new BpmApiError(
                `Не удалось определить статусное поле в коллекции ${collection}.`,
                400,
                collection
              );
            }
    
            const lookupInfo = await services.metadataManager.getLookupInfo(collection, statusField.name);
            if (!lookupInfo) {
              throw new BpmApiError(
                `Поле ${statusField.name} в ${collection} не является lookup-полем — изменение статуса невозможно.`,
                400,
                collection
              );
            }
    
            const lookupResult = await services.lookupResolver.resolve(
              lookupInfo.lookupCollection,
              params.status,
              lookupInfo.displayColumn
            );
            if (!lookupResult.resolved || !lookupResult.id) {
              throw new BpmApiError(
                `Статус "${params.status}" не разрешён в справочнике ${lookupInfo.lookupCollection}.${lookupInfo.displayColumn} (matchCount=${lookupResult.matchCount}).`,
                400,
                collection,
                undefined,
                lookupResult.candidates.map((c) => c.displayValue),
                [
                  `Запросите доступные значения: bpm_get_records(${lookupInfo.lookupCollection}, select='Id,${lookupInfo.displayColumn}').`,
                ]
              );
            }
    
            await services.odataClient.updateRecord(collection, params.id, {
              [statusField.name]: lookupResult.id,
            });
    
            return {
              content: [
                {
                  type: 'text',
                  text: `Статус ${collection}(${params.id}) установлен: ${statusField.name} = "${params.status}" (${lookupResult.id}).`,
                },
              ],
              structuredContent: {
                collection,
                id: params.id,
                status_field: statusField.name,
                status_id: lookupResult.id,
                status_value: params.status,
              },
            };
          } catch (error) {
            const toolError = formatToolError(error, params.collection);
            return {
              content: [{ type: 'text', text: JSON.stringify(toolError, null, 2) }],
              isError: true,
            };
          }
        }
      );
    }
  • Helper that checks if a field name contains 'status', 'stage', or 'state' (case-insensitive) to auto-detect status fields in entity metadata.
    function isStatusFieldName(name: string): boolean {
      const lower = name.toLowerCase();
      return lower.includes('status') || lower.includes('stage') || lower.includes('state');
    }
  • Zod input schema defining the 4 parameters: collection (string), id (UUID string), status (human-readable status name), and optional status_field (explicit field name when ambiguity exists).
    inputSchema: {
      collection: z.string().describe('Имя коллекции (EntitySet), например: Opportunity, Lead, Activity'),
      id: z.string().describe('UUID записи, у которой меняется статус'),
      status: z.string().describe('Человекочитаемое имя статуса (Name справочника)'),
      status_field: z
        .string()
        .optional()
        .describe(
          'Явное имя поля-статуса (если в коллекции несколько кандидатов: StatusId, StageId и т.п.)'
        ),
    },
    annotations: meta.annotations,
  • Tool metadata registration in the central registry TOOLS array, with name, title, description, annotations (idempotent, open-world), blurb, and category 'workflow'.
      name: 'bpm_set_status',
      title: 'Установить статус записи',
      description:
        'Установить статус записи по человекочитаемому имени. Сервер сам найдёт поле-статус в коллекции (StatusId/StageId) и разрешит UUID статуса в его справочнике.',
      annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
      blurb: 'установить статус по имени (Status/Stage авто-детект)',
      category: 'workflow',
    },
Behavior4/5

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

Annotations provide idempotentHint and openWorldHint. Description adds that the server resolves the human-readable name to a UUID, which clarifies the underlying lookup. No contradictions.

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?

Two sentences, no redundancy, conveys all necessary information efficiently.

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?

No output schema, but for a status setter, the description is mostly sufficient. Could mention return value (success/error) but not critical given tool simplicity.

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

Parameters4/5

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

Schema covers all parameters with descriptions. Description adds that status is a human-readable name (not UUID) and explains when status_field is needed, augmenting the schema.

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?

Description clearly states the tool sets a record status by human-readable name, and explains the server resolves the status field automatically. This distinguishes it from generic update tools like bpm_update_record.

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

Usage Guidelines4/5

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

Description implies usage when setting status by name, and notes the optional status_field parameter for ambiguous cases. However, it does not explicitly state when not to use or provide alternatives.

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/Catter58/mcpBPMSoft'

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