# MCP: chains

Source: <https://telegafirst.com/docs/mcp-chains>
Locale: ru
releaseGitSha: c9a428d902de0b479a981e43774f38b9ec077ed7
sourceContentDigest: 264230b8d03fff7dfb55b402a500fed47c5926644343be3fccffb9e0d1eef10f
Version: 1

# MCP: chains

Это определения инструментов из текущего ToolRegistry, включая полные inputSchema/outputSchema, scope, required\_scopes (ALL), risk и версию платформы. Наличие определения не означает, что инструмент уже установлен вашим хостом или разрешён вашим credential. Обновляйте tools/list после изменения бизнеса, readiness и прав. Progressive disclosure через load\_domain/describe\_tool и существующий meta-dispatch описаны в [MCP-руководстве](https://telegafirst.com/docs/mcp-guide). [Scopes и права](https://telegafirst.com/docs/scopes-and-permissions) применяются при вызове; risk не заменяет согласие и отдельные требования денежной операции. JSON ниже — схема, а не успешный результат вызова.

## create\_chain\_step

Add a step to a tenant message chain. The platform assigns the step `seqNum`; use it for all later references. The first step becomes an entry point. Add content through the existing content-publish workflow when needed.

```json
{
  "description": "Add a step to a tenant message chain. The platform assigns the step `seqNum`; use it for all later references. The first step becomes an entry point. Add content through the existing content-publish workflow when needed.",
  "domain": "chains",
  "inputSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "additionalProperties": false,
    "properties": {
      "bot": {
        "description": "Optional slug of the bot you expect to act on (get_active_bot). If the active bot differs, the call is refused with ACTIVE_BOT_CHANGED and nothing runs.",
        "maxLength": 128,
        "minLength": 1,
        "type": "string"
      },
      "chain_seq_num": {
        "description": "Value for chain seq num.",
        "exclusiveMinimum": 0,
        "maximum": 9007199254740991,
        "type": "integer"
      },
      "delay_minutes": {
        "description": "Value for delay minutes.",
        "maximum": 9007199254740991,
        "minimum": 0,
        "type": "integer"
      },
      "title": {
        "anyOf": [
          {
            "description": "Value for title option.",
            "maxLength": 120,
            "type": "string"
          },
          {
            "description": "Value for title option.",
            "type": "null"
          }
        ],
        "description": "Value for title."
      }
    },
    "required": [
      "chain_seq_num"
    ],
    "type": "object"
  },
  "name": "create_chain_step",
  "outputSchema": null,
  "platform_version": "1.0.19",
  "required_scopes": [
    "chains:write"
  ],
  "risk": "write",
  "scope": "chains:write",
  "title": "Create Chain Step"
}
```

## create\_message\_chain

Create a message chain (a shell — add its steps afterwards in the Settings supergroup / Mini App). Provide a title. Returns the created chain with its assigned `seqNum`.

```json
{
  "description": "Create a message chain (a shell — add its steps afterwards in the Settings supergroup / Mini App). Provide a title. Returns the created chain with its assigned `seqNum`.",
  "domain": "chains",
  "inputSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "additionalProperties": false,
    "properties": {
      "bot": {
        "description": "Optional slug of the bot you expect to act on (get_active_bot). If the active bot differs, the call is refused with ACTIVE_BOT_CHANGED and nothing runs.",
        "maxLength": 128,
        "minLength": 1,
        "type": "string"
      },
      "title": {
        "description": "Value for title.",
        "maxLength": 200,
        "minLength": 1,
        "type": "string"
      }
    },
    "required": [
      "title"
    ],
    "type": "object"
  },
  "name": "create_message_chain",
  "outputSchema": null,
  "platform_version": "1.0.19",
  "required_scopes": [
    "chains:write"
  ],
  "risk": "write",
  "scope": "chains:write",
  "title": "Create Message Chain"
}
```

## delete\_chain\_step

Soft-delete a chain step by tenant-local chain and step sequence numbers. Repeating a successful deletion is idempotent.

```json
{
  "description": "Soft-delete a chain step by tenant-local chain and step sequence numbers. Repeating a successful deletion is idempotent.",
  "domain": "chains",
  "inputSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "additionalProperties": false,
    "properties": {
      "bot": {
        "description": "Optional slug of the bot you expect to act on (get_active_bot). If the active bot differs, the call is refused with ACTIVE_BOT_CHANGED and nothing runs.",
        "maxLength": 128,
        "minLength": 1,
        "type": "string"
      },
      "chain_seq_num": {
        "description": "Value for chain seq num.",
        "exclusiveMinimum": 0,
        "maximum": 9007199254740991,
        "type": "integer"
      },
      "step_seq_num": {
        "description": "Value for step seq num.",
        "exclusiveMinimum": 0,
        "maximum": 9007199254740991,
        "type": "integer"
      }
    },
    "required": [
      "chain_seq_num",
      "step_seq_num"
    ],
    "type": "object"
  },
  "name": "delete_chain_step",
  "outputSchema": null,
  "platform_version": "1.0.19",
  "required_scopes": [
    "chains:write"
  ],
  "risk": "destructive",
  "scope": "chains:write",
  "title": "Delete Chain Step"
}
```

## delete\_message\_chain

Soft-delete a message chain by `seqNum`. Idempotent (deleting an absent/already-deleted chain returns deleted:true).

```json
{
  "description": "Soft-delete a message chain by `seqNum`. Idempotent (deleting an absent/already-deleted chain returns deleted:true).",
  "domain": "chains",
  "inputSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "additionalProperties": false,
    "properties": {
      "bot": {
        "description": "Optional slug of the bot you expect to act on (get_active_bot). If the active bot differs, the call is refused with ACTIVE_BOT_CHANGED and nothing runs.",
        "maxLength": 128,
        "minLength": 1,
        "type": "string"
      },
      "seq_num": {
        "description": "Value for seq num.",
        "exclusiveMinimum": 0,
        "maximum": 9007199254740991,
        "type": "integer"
      }
    },
    "required": [
      "seq_num"
    ],
    "type": "object"
  },
  "name": "delete_message_chain",
  "outputSchema": null,
  "platform_version": "1.0.19",
  "required_scopes": [
    "chains:write"
  ],
  "risk": "destructive",
  "scope": "chains:write",
  "title": "Delete Message Chain"
}
```

## execute\_chain\_batch\_entry

Enter users into the chain identified by a matching prepared scenario. Call this tool only after final human confirmation of the prepared scenario.

```json
{
  "description": "Enter users into the chain identified by a matching prepared scenario. Call this tool only after final human confirmation of the prepared scenario.",
  "domain": "chains",
  "inputSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "additionalProperties": false,
    "properties": {
      "bot": {
        "description": "Optional slug of the bot you expect to act on (get_active_bot). If the active bot differs, the call is refused with ACTIVE_BOT_CHANGED and nothing runs.",
        "maxLength": 128,
        "minLength": 1,
        "type": "string"
      },
      "payload_hash": {
        "description": "Value for payload hash.",
        "pattern": "^[a-f0-9]{64}$",
        "type": "string"
      },
      "preparation_id": {
        "description": "Value for preparation id.",
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
        "type": "string"
      }
    },
    "required": [
      "preparation_id",
      "payload_hash"
    ],
    "type": "object"
  },
  "name": "execute_chain_batch_entry",
  "outputSchema": null,
  "platform_version": "1.0.19",
  "required_scopes": [
    "chains:write"
  ],
  "risk": "write",
  "scope": "chains:write",
  "title": "Execute Chain Batch Entry"
}
```

## list\_chain\_runs

List recorded message-chain runs for the current tenant. Optionally filter by the customer `user_seq_num`; all returned entity references use tenant-scoped sequence numbers.

```json
{
  "description": "List recorded message-chain runs for the current tenant. Optionally filter by the customer `user_seq_num`; all returned entity references use tenant-scoped sequence numbers.",
  "domain": "chains",
  "inputSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "additionalProperties": false,
    "properties": {
      "limit": {
        "description": "Value for limit.",
        "exclusiveMinimum": 0,
        "maximum": 100,
        "type": "integer"
      },
      "user_seq_num": {
        "description": "Value for user seq num.",
        "exclusiveMinimum": 0,
        "maximum": 9007199254740991,
        "type": "integer"
      }
    },
    "type": "object"
  },
  "name": "list_chain_runs",
  "outputSchema": null,
  "platform_version": "1.0.19",
  "required_scopes": [
    "chains:read"
  ],
  "risk": "read",
  "scope": "chains:read",
  "title": "List Chain Runs"
}
```

## list\_chain\_steps

List steps of one message chain. Every result carries tenant-local `seqNum`; pass that number (never a database id) to update or delete a step. The chain graph is computed from these step rows. 0-cost read.

```json
{
  "description": "List steps of one message chain. Every result carries tenant-local `seqNum`; pass that number (never a database id) to update or delete a step. The chain graph is computed from these step rows. 0-cost read.",
  "domain": "chains",
  "inputSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "additionalProperties": false,
    "properties": {
      "chain_seq_num": {
        "description": "Value for chain seq num.",
        "exclusiveMinimum": 0,
        "maximum": 9007199254740991,
        "type": "integer"
      }
    },
    "required": [
      "chain_seq_num"
    ],
    "type": "object"
  },
  "name": "list_chain_steps",
  "outputSchema": null,
  "platform_version": "1.0.19",
  "required_scopes": [
    "chains:read"
  ],
  "risk": "read",
  "scope": "chains:read",
  "title": "List Chain Steps"
}
```

## list\_message\_chains

List the tenant message chains (automated message sequences). Returns each with its `seqNum` (the id you pass to update/delete), title, computed active flag and engine-assigned deeplink code. 0-cost read. (Chain STEPS are managed separately in the Settings supergroup / Mini App.)

```json
{
  "description": "List the tenant message chains (automated message sequences). Returns each with its `seqNum` (the id you pass to update/delete), title, computed active flag and engine-assigned deeplink code. 0-cost read. (Chain STEPS are managed separately in the Settings supergroup / Mini App.)",
  "domain": "chains",
  "inputSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "additionalProperties": false,
    "properties": {},
    "type": "object"
  },
  "name": "list_message_chains",
  "outputSchema": null,
  "platform_version": "1.0.19",
  "required_scopes": [
    "chains:read"
  ],
  "risk": "read",
  "scope": "chains:read",
  "title": "List Message Chains"
}
```

## prepare\_chain\_batch\_entry

Prepare entry of up to 50 users into a message chain. You MUST name `on_active`: `noop` preserves a live run, `deliver` sends the selected step without moving it, and `restart` abandons it before a new run. Show the immutable prepared scenario to a human before executing it.

```json
{
  "description": "Prepare entry of up to 50 users into a message chain. You MUST name `on_active`: `noop` preserves a live run, `deliver` sends the selected step without moving it, and `restart` abandons it before a new run. Show the immutable prepared scenario to a human before executing it.",
  "domain": "chains",
  "inputSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "additionalProperties": false,
    "properties": {
      "bot": {
        "description": "Optional slug of the bot you expect to act on (get_active_bot). If the active bot differs, the call is refused with ACTIVE_BOT_CHANGED and nothing runs.",
        "maxLength": 128,
        "minLength": 1,
        "type": "string"
      },
      "chain_seq_num": {
        "description": "Value for chain seq num.",
        "exclusiveMinimum": 0,
        "maximum": 9007199254740991,
        "type": "integer"
      },
      "on_active": {
        "description": "Value for on active.",
        "enum": [
          "noop",
          "restart",
          "deliver"
        ],
        "type": "string"
      },
      "step_seq_num": {
        "description": "Value for step seq num.",
        "exclusiveMinimum": 0,
        "maximum": 9007199254740991,
        "type": "integer"
      },
      "user_seq_nums": {
        "description": "Value for user seq nums.",
        "items": {
          "description": "Value for user seq nums item.",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991,
          "type": "integer"
        },
        "maxItems": 50,
        "minItems": 1,
        "type": "array"
      }
    },
    "required": [
      "chain_seq_num",
      "user_seq_nums",
      "on_active"
    ],
    "type": "object"
  },
  "name": "prepare_chain_batch_entry",
  "outputSchema": null,
  "platform_version": "1.0.19",
  "required_scopes": [
    "chains:write"
  ],
  "risk": "write",
  "scope": "chains:write",
  "title": "Prepare Chain Batch Entry"
}
```

## update\_chain\_step

Patch one chain step by `chain_seq_num` plus `step_seq_num`. Steps own title, buttons and targets, timeout and timeout target, entry-point and active state, delay, message lifetime and prior-message deletion. Navigation and timeout targets are step seqNums in the same chain. The chain shell has no stored active state: its graph is computed from steps.

```json
{
  "description": "Patch one chain step by `chain_seq_num` plus `step_seq_num`. Steps own title, buttons and targets, timeout and timeout target, entry-point and active state, delay, message lifetime and prior-message deletion. Navigation and timeout targets are step seqNums in the same chain. The chain shell has no stored active state: its graph is computed from steps.",
  "domain": "chains",
  "inputSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "additionalProperties": false,
    "properties": {
      "bot": {
        "description": "Optional slug of the bot you expect to act on (get_active_bot). If the active bot differs, the call is refused with ACTIVE_BOT_CHANGED and nothing runs.",
        "maxLength": 128,
        "minLength": 1,
        "type": "string"
      },
      "button_target": {
        "anyOf": [
          {
            "description": "Value for button target option.",
            "oneOf": [
              {
                "additionalProperties": false,
                "description": "Value for button target option option.",
                "properties": {
                  "kind": {
                    "const": "delivery_message",
                    "description": "Value for kind.",
                    "type": "string"
                  }
                },
                "required": [
                  "kind"
                ],
                "type": "object"
              },
              {
                "additionalProperties": false,
                "description": "Value for button target option option.",
                "properties": {
                  "kind": {
                    "const": "url",
                    "description": "Value for kind.",
                    "type": "string"
                  },
                  "url": {
                    "description": "Value for url.",
                    "format": "uri",
                    "type": "string"
                  }
                },
                "required": [
                  "kind",
                  "url"
                ],
                "type": "object"
              },
              {
                "additionalProperties": false,
                "description": "Value for button target option option.",
                "properties": {
                  "kind": {
                    "const": "web_app",
                    "description": "Value for kind.",
                    "type": "string"
                  },
                  "web_app_url": {
                    "description": "Value for web app url.",
                    "format": "uri",
                    "type": "string"
                  }
                },
                "required": [
                  "kind",
                  "web_app_url"
                ],
                "type": "object"
              },
              {
                "additionalProperties": false,
                "description": "Value for button target option option.",
                "properties": {
                  "kind": {
                    "const": "section_root",
                    "description": "Value for kind.",
                    "type": "string"
                  },
                  "section": {
                    "description": "Value for section.",
                    "enum": [
                      "catalog",
                      "booking",
                      "events"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "kind",
                  "section"
                ],
                "type": "object"
              },
              {
                "additionalProperties": false,
                "description": "Value for button target option option.",
                "properties": {
                  "entity_seq": {
                    "description": "Value for entity seq.",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991,
                    "type": "integer"
                  },
                  "entity_type": {
                    "description": "Value for entity type.",
                    "enum": [
                      "product",
                      "catalog_group",
                      "menu_group",
                      "event",
                      "resource",
                      "chain_step",
                      "marketing_campaign",
                      "marketing_link",
                      "form"
                    ],
                    "type": "string"
                  },
                  "kind": {
                    "const": "deeplink",
                    "description": "Value for kind.",
                    "type": "string"
                  }
                },
                "required": [
                  "kind",
                  "entity_type",
                  "entity_seq"
                ],
                "type": "object"
              }
            ]
          },
          {
            "description": "Value for button target option.",
            "type": "null"
          }
        ],
        "description": "Value for button target."
      },
      "button_title": {
        "anyOf": [
          {
            "description": "Value for button title option.",
            "maxLength": 100,
            "type": "string"
          },
          {
            "description": "Value for button title option.",
            "type": "null"
          }
        ],
        "description": "Value for button title."
      },
      "chain_seq_num": {
        "description": "Value for chain seq num.",
        "exclusiveMinimum": 0,
        "maximum": 9007199254740991,
        "type": "integer"
      },
      "deeplink_buttons": {
        "description": "Value for deeplink buttons.",
        "items": {
          "additionalProperties": false,
          "description": "Value for deeplink buttons item.",
          "properties": {
            "icon_custom_emoji_id": {
              "anyOf": [
                {
                  "description": "Value for icon custom emoji id option.",
                  "maxLength": 32,
                  "type": "string"
                },
                {
                  "description": "Value for icon custom emoji id option.",
                  "type": "null"
                }
              ],
              "description": "Value for icon custom emoji id."
            },
            "style": {
              "anyOf": [
                {
                  "description": "Value for style option.",
                  "maxLength": 16,
                  "type": "string"
                },
                {
                  "description": "Value for style option.",
                  "type": "null"
                }
              ],
              "description": "Value for style."
            },
            "target_seq_num": {
              "description": "Value for target seq num.",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991,
              "type": "integer"
            },
            "title": {
              "description": "Value for title.",
              "maxLength": 100,
              "minLength": 1,
              "type": "string"
            }
          },
          "required": [
            "title",
            "target_seq_num"
          ],
          "type": "object"
        },
        "maxItems": 100,
        "type": "array"
      },
      "delay_minutes": {
        "description": "Value for delay minutes.",
        "maximum": 9007199254740991,
        "minimum": 0,
        "type": "integer"
      },
      "delete_prev_if_unengaged": {
        "description": "Value for delete prev if unengaged.",
        "type": "boolean"
      },
      "is_active": {
        "description": "Value for is active.",
        "type": "boolean"
      },
      "is_entry_point": {
        "description": "Value for is entry point.",
        "type": "boolean"
      },
      "message_ttl_minutes": {
        "anyOf": [
          {
            "description": "Value for message ttl minutes option.",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991,
            "type": "integer"
          },
          {
            "description": "Value for message ttl minutes option.",
            "type": "null"
          }
        ],
        "description": "Value for message ttl minutes."
      },
      "step_seq_num": {
        "description": "Value for step seq num.",
        "exclusiveMinimum": 0,
        "maximum": 9007199254740991,
        "type": "integer"
      },
      "timeout_minutes": {
        "anyOf": [
          {
            "description": "Value for timeout minutes option.",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991,
            "type": "integer"
          },
          {
            "description": "Value for timeout minutes option.",
            "type": "null"
          }
        ],
        "description": "Value for timeout minutes."
      },
      "timeout_next_step_seq": {
        "anyOf": [
          {
            "description": "Value for timeout next step seq option.",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991,
            "type": "integer"
          },
          {
            "description": "Value for timeout next step seq option.",
            "type": "null"
          }
        ],
        "description": "Value for timeout next step seq."
      },
      "title": {
        "anyOf": [
          {
            "description": "Value for title option.",
            "maxLength": 120,
            "type": "string"
          },
          {
            "description": "Value for title option.",
            "type": "null"
          }
        ],
        "description": "Value for title."
      }
    },
    "required": [
      "chain_seq_num",
      "step_seq_num"
    ],
    "type": "object"
  },
  "name": "update_chain_step",
  "outputSchema": null,
  "platform_version": "1.0.19",
  "required_scopes": [
    "chains:write"
  ],
  "risk": "write",
  "scope": "chains:write",
  "title": "Update Chain Step"
}
```

## update\_message\_chain

Update a message chain by its `seqNum` (a partial patch — send only the fields you change). Idempotent. Returns the updated chain. Errors NOT\_FOUND if the seqNum does not exist for your tenant.

```json
{
  "description": "Update a message chain by its `seqNum` (a partial patch — send only the fields you change). Idempotent. Returns the updated chain. Errors NOT_FOUND if the seqNum does not exist for your tenant.",
  "domain": "chains",
  "inputSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "additionalProperties": false,
    "properties": {
      "bot": {
        "description": "Optional slug of the bot you expect to act on (get_active_bot). If the active bot differs, the call is refused with ACTIVE_BOT_CHANGED and nothing runs.",
        "maxLength": 128,
        "minLength": 1,
        "type": "string"
      },
      "seq_num": {
        "description": "Value for seq num.",
        "exclusiveMinimum": 0,
        "maximum": 9007199254740991,
        "type": "integer"
      },
      "title": {
        "description": "Value for title.",
        "maxLength": 200,
        "minLength": 1,
        "type": "string"
      }
    },
    "required": [
      "seq_num"
    ],
    "type": "object"
  },
  "name": "update_message_chain",
  "outputSchema": null,
  "platform_version": "1.0.19",
  "required_scopes": [
    "chains:write"
  ],
  "risk": "write",
  "scope": "chains:write",
  "title": "Update Message Chain"
}
```
