Skip to main content
Glama

Invoke MTProto

invoke_mtproto
Destructive

Invoke low-level Telegram MTProto API methods not covered by other tools, with dangerous-method gating and default filtering of sensitive fields.

Instructions

Low-level Telegram API (MTProto) invoke for methods not wrapped by other tools. Dangerous methods require allow_dangerous=true. Success: API result dict or normalized error. PII and credential-shaped fields (phone, access_hash) are dropped from a successful result by default; pass include_sensitive=true for the raw payload. A bare message id needs a chat binding: requests with no peer field (messages.GetMessages, messages.DeleteMessages) are refused, because a bare id resolves against an arbitrary dialog. Use channels.GetMessages or messages.GetHistory, which carry the binding. messages.GetHistory cannot address a forum topic (no thread_id/top_msg_id in the schema, and channels.GetHistory does not exist) -- use messages.Search with top_msg_id, or the high-level get_messages with reply_to_id. Full documentation: https://github.com/leshchenko1979/fast-mcp-telegram/blob/main/docs/Tools-Reference.md

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": {
      "method_full_name": "<method_full_name>",
      "params_json": "<params_json>"
    },
    "name": "invoke_mtproto"
  }
}

Input Schema

NameRequiredDescriptionDefault
resolveNoIf true, resolve string/int peer-like fields to TL Input* entities before invoke.
params_jsonYesJSON object string of TL parameters as in Telegram API docs; nested TL uses "_": "typeName" discriminator.
allow_dangerousNoIf false, destructive methods (e.g. deletes) are blocked. Set true only when intended.
method_full_nameYesTelegram API method, e.g. "messages.GetHistory" or "users.GetFullUser" (normalization applied).
include_sensitiveNoIf true, return the raw result including PII and credential-shaped fields (phone, access_hash). Default false drops them.

Output Schema

NameRequiredDescriptionDefault
_No
idNo
okNo
codeNo
dateNo
chatsNo
errorNo
usersNo
actionNo
paramsNo
resultNo
messagesNo
exceptionNo
operationNo
error_codeNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.45.0
    • addedInput schema / properties / include_sensitive
      Added value: +{
      +  "default": false,
      +  "description": "If true, return the raw result including PII and credential-shaped fields (phone, access_hash). Default false drops them.",
      +  "type": "boolean"
      +}
    • removedOutput schema / properties / result / additionalProperties
      Removed value: -true
    • removedOutput schema / properties / result / type
      Removed value: -"object"
  2. Changed3 schema fields changedv0.36.0
    • removedOutput schema / additionalProperties
      Removed value: -true
    • addedOutput schema / description
      Added value: +"Return type for ``invoke_mtproto``.\n\nThe success payload is a JSON-safe dict whose shape depends on the\nTelegram API method invoked.  Common top-level fields are listed here;\neverything else passes through as-is."
    • addedOutput schema / properties
      Added value: +{
      +  "_": {
      +    "type": "string"
      +  },
      +  "action": {
      +    "type": "string"
      +  },
      +  "chats": {
      +    "items": {
      +      "additionalProperties": true,
      +      "type": "object"
      +    },
      +    "type": "array"
      +  },
      +  "code": {
      +    "type": "integer"
      +  },
      +  "date": {
      +    "type": "integer"
      +  },
      +  "error": {
      +    "type": "string"
      +  },
      +  "error_code": {
      +    "type": "string"
      +  },
      +  "exception": {
      +    "additionalProperties": true,
      +    "type": "object"
      +  },
      +  "id": {
      +    "type": "integer"
      +  },
      +  "messages": {
      +    "items": {
      +      "additionalProperties": true,
      +      "type": "object"
      +    },
      +    "type": "array"
      +  },
      +  "ok": {
      +    "type": "boolean"
      +  },
      +  "operation": {
      +    "type": "string"
      +  },
      +  "params": {
      +    "additionalProperties": true,
      +    "type": "object"
      +  },
      +  "result": {
      +    "additionalProperties": true,
      +    "type": "object"
      +  },
      +  "users": {
      +    "items": {
      +      "additionalProperties": true,
      +      "type": "object"
      +    },
      +    "type": "array"
      +  }
      +}
  3. First observedv0.21.0

TDQS

A4.9/5.0
Behavior5/5

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

Annotations already declare destructiveHint=true, readOnlyHint=false and openWorldHint=true, and the description adds substantial behavior beyond that: success returns an API result dict or a normalized error, PII/credential-shaped fields (phone, access_hash) are dropped unless include_sensitive=true, and peer-less requests are refused at the boundary. It also discloses a capability limitation (no thread_id/top_msg_id for forum topics, channels.GetHistory non-existent), which is exactly the kind of hidden constraint an agent cannot get from structured fields.

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?

Content is front-loaded: purpose, safety gate, and return shape come before the deep workaround detail, and every sentence carries information. It is dense and long-winded in the forum-topic sentence, but nothing is padding or repetition of the schema.

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 an open-world, destructive, low-level invoke tool with five parameters and a documented output schema, the description covers return shape, error normalization, sensitive-data handling, refusal conditions, and known dead ends with alternatives. An agent has everything needed to call it correctly on the first attempt.

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

Parameters5/5

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

Schema coverage is already 100% (baseline 3), but the description adds real meaning: it explains that allow_dangerous is a safety gate for destructive methods, that include_sensitive controls sensitive-field stripping, and that the params_json surface structurally lacks thread_id/top_msg_id. That last point is a semantics detail no individual parameter doc conveys.

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?

"Low-level Telegram API (MTProto) invoke for methods not wrapped by other tools" names a specific verb and resource and explicitly defines the tool as the escape hatch outside the high-level siblings. An agent can immediately tell this apart from get_messages or send_message without inspecting either schema.

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 the gate condition for the escape hatch (methods not wrapped elsewhere), the prerequisite for destructive methods (allow_dangerous=true), the exact class of request that is refused (no peer field: messages.GetMessages/DeleteMessages), and concrete substitute methods (channels.GetMessages, messages.GetHistory, messages.Search with top_msg_id, or high-level get_messages). This is explicit when-to-use, when-not-to-use, and alternatives.

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