Skip to main content
Glama
mcp-1c-local-bridge

mcp-1c-local-bridge

by ntappw

execute

Runs a 1C/BSL code snippet inside an open 1C session and returns the value assigned to the Result variable, with changes rolled back by default.

Instructions

Выполняет фрагмент кода 1С (Выполнить) и возвращает значение переменной Результат.

На сервере код по умолчанию идёт в транзакции, которая после выполнения откатывается: изменения в базе
не сохраняются. Внешние эффекты откат не отменяет: файлы, HTTP, почта, запуск фоновых заданий, записи
журнала регистрации. Сообщения пользователю (Сообщить) с сервера возвращаются в ответе.

Выполнение занимает окно 1С пользователя: пока код работает, интерфейс его сеанса не отвечает. Долгую
операцию (обмен, массовую обработку) одним execute не запускай: если у неё есть экспортный метод общего
модуля конфигурации, запусти его фоновым заданием (ФоновыеЗадания.Выполнить) и опрашивай состояние задания
короткими командами. Фоновое задание идёт в своём сеансе, вне транзакции моста: его запись в базу не
откатывается и разрешением «Запись в базу» не ограничена - запускай его только с allow_write=true и с
согласия пользователя.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "code": "<code>"
    },
    "name": "execute"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesКод 1С: операторы без объявлений Процедура/Функция; результат присвойте переменной Результат.
sideNoserver - на сервере 1С; client - на клиенте, в служебной форме обработки (нужно разрешение «Код на клиенте» на форме, транзакции и отката нет; при выдаче с подтверждением не выполняется).server
formatNotable - таблицы и сводки для чтения, ссылки показаны представлениями; json - ответ как есть, с типами и UUID ссылок.json
sessionNoСеанс моста: идентификатор из sessions или часть строки соединения, имени конфигурации, пользователя. Не указан - единственный открытый сеанс.
timeoutNoСколько секунд ждать ответ. Команда, которую обработка не начала за это время, снимается; начатая выполняется дальше, её результат забирается инструментом result.
allow_writeNotrue - сохранить изменения, если на форме включено разрешение «Запись в базу»: по умолчанию код идёт в транзакции, которая фиксируется, только если он отработал без ошибок (см. transaction). Пока разрешение выключено, код всё равно выполнится с откатом, в ответе будет предупреждение.
transactionNoТолько для записи (allow_write=true). true - в транзакции: при ошибке изменения откатываются целиком. false - без транзакции моста: что код успел записать до ошибки, остаётся. false нужен долгим операциям (транзакция держит блокировки всё время выполнения) и коду, который сам управляет транзакциями или ждёт фоновые задания.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.6.0
    • changedInput schema / properties / side / description
      Previous value: -"server - на сервере 1С; client - в модуле формы обработки на клиенте (нужно разрешение «Код на клиенте» на форме, транзакции и отката нет)."New value: +"server - на сервере 1С; client - на клиенте, в служебной форме обработки (нужно разрешение «Код на клиенте» на форме, транзакции и отката нет; при выдаче с подтверждением не выполняется)."
  2. Changed2 schema fields changedv1.4.0
    • changedInput schema / properties / allow_write / description
      Previous value: -"true - выполнить без отката транзакции, изменения сохранятся, если на форме включено разрешение «Запись в базу». Пока оно выключено, код всё равно выполнится с откатом, в ответе будет предупреждение."New value: +"true - сохранить изменения, если на форме включено разрешение «Запись в базу»: по умолчанию код идёт в транзакции, которая фиксируется, только если он отработал без ошибок (см. transaction). Пока разрешение выключено, код всё равно выполнится с откатом, в ответе будет предупреждение."
    • addedInput schema / properties / transaction
      Added value: +{
      +  "default": true,
      +  "description": "Только для записи (allow_write=true). true - в транзакции: при ошибке изменения откатываются целиком. false - без транзакции моста: что код успел записать до ошибки, остаётся. false нужен долгим операциям (транзакция держит блокировки всё время выполнения) и коду, который сам управляет транзакциями или ждёт фоновые задания.",
      +  "title": "Transaction",
      +  "type": "boolean"
      +}
  3. First observedv1.1.0

TDQS

A4.5/5.0
Behavior5/5

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

With no annotations supplied, the description carries the full burden and does so: server code runs in a transaction that is rolled back by default, external effects (files, HTTP, mail, background jobs, log records) are not rolled back, and user messages are returned in the response. It also warns that execution blocks the user's 1C session UI for the duration, and that a background job runs in its own session outside the bridge transaction and is not limited by the 'Запись в базу' permission.

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?

It is front-loaded with the one-line purpose, then layers rollback semantics, blocking behaviour and background-job guidance in descending order of importance; every paragraph carries operational consequence. It is long for a tool description, but no sentence is filler, so 4 rather than 5 for sheer length.

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

Completeness5/5

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

For a high-risk arbitrary-code-execution tool with seven parameters, the description covers the dangerous defaults an agent could otherwise trip: the rollback-by-default transaction, the non-reversible external effects, the session-blocking cost, and the consent requirement for writes. An output schema exists, so return values need not be described.

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 coverage is 100%, so the baseline is 3, but the description adds real meaning on top: it explains that transaction=true commits only if the code finishes without error, that transaction=false is reserved for write mode and needed for long or self-managing code, and that allow_write without the form permission still executes but rolls back with a warning. That deepens allow_write/transaction beyond their own schema text, though it does not touch code, side, format or session.

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

Purpose4/5

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

The opening line gives a specific verb and resource ('Выполняет фрагмент кода 1С') and states what is returned ('значение переменной Результат'), which is more than a restatement of the name. It does not distinguish this tool from its 'eval' or 'query' siblings, so an agent must infer the boundary itself. That single gap keeps it at 4 rather than 5.

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

Usage Guidelines5/5

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

It states explicit when-not guidance: long operations such as exchanges or mass processing should not be run in one execute but launched as a background job via ФоновыеЗадания.Выполнить and polled with short commands. It also gives the precondition for the write path (allow_write=true only with user consent) and routes the agent to the 'result' sibling to collect the output of a command that outlived its timeout.

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