Skip to main content
Glama

Read a Telegram attachment

telegram_get_file
Idempotent

Read a document shared in Telegram and answer questions about its contents, such as a contract, invoice or spreadsheet. First locate the message with telegram_get_messages or telegram_search_messages to obtain chat_id and message_id. This does not search for files by name. For a spreadsheet (.xlsx), Word document (.docx), PDF or any text format this returns the actual contents — cells, paragraphs, rows — so you can answer questions about what is inside it. Spreadsheet rows come back tab-separated, one sheet per '## name' heading. For a video, audio or image there is a link and metadata; Session audio/video also returns a ready transcript when available. Reusing a ready bot or Session transcript is free. For Session audio/video, transcribe=true explicitly requests a new transcript using ordinary minutes only if none exists. Pending work persists; check again later, without repeated polling. Use the chat_id and message_id of a message whose message_type is not 'text'. Telegram refuses to serve files over 20 MB to a bot, so those cannot be fetched. Use an already connected Session where supported; preserve source, coverage and actual errors. Do not suggest connecting or reconnecting Session unless the user explicitly asks for Session setup. Never switch sender automatically or request login codes/passwords in chat.

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": {
      "chat_id": "<chat_id>",
      "message_id": "<message_id>"
    },
    "name": "telegram_get_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
chat_idYesChat the file is in.
max_charsNoHow much text to return at once. Defaults to a readable slice.
message_idYesmessage_id of the message carrying the file.
transcribeNoDefault false. Only on an explicit user request, transcribe Session audio/video if no ready transcript exists; consumes normal minutes on success.
include_textNoDefault true. Set false to get only metadata and skip reading contents.
offset_linesNoSkip this many lines before reading. A big spreadsheet does not fit in one response, so page through it: the result says which lines you got and how many there are in total.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / transcribe
      Added value: +{
      +  "description": "Default false. Only on an explicit user request, transcribe Session audio/video if no ready transcript exists; consumes normal minutes on success.",
      +  "type": "boolean"
      +}
  2. First observed

TDQS

A4.4/5.0
Behavior5/5

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

Annotations are minimal and partly counterintuitive (readOnlyHint=false on what reads as a read operation), and the description closes that gap by explaining that transcribe=true consumes ordinary minutes, that a ready bot/Session transcript is free, that pending work persists so you should not poll repeatedly, and that Telegram refuses files over 20 MB. It also describes the return shape (tab-separated rows, '## name' sheet headings) and the paging signal, which is behavior an agent cannot get from the annotations. Nothing here contradicts the annotation set; the non-read-only hint is consistent with the metered transcription path.

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

Conciseness3/5

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

The critical information (locate message, 20 MB cap, paging, transcribe cost) is front-loaded and easy to find. However, a substantial tail of the description is Session-policy boilerplate — 'Do not suggest connecting or reconnecting Session', 'Never switch sender automatically or request login codes/passwords in chat' — that does not help an agent select or invoke this tool and dilutes an otherwise tight definition.

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?

For a six-parameter fetch tool with no output schema, the description covers the essentials an agent needs: how to get the IDs, the size ceiling, the content format for each file class, paging, and the cost model for transcription. It stops short of describing failure modes (expired message, inaccessible chat) or how a partial transcript is signalled, and the Session asides add noise rather than completeness.

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, and the prose earns an increment by adding real meaning: offset_lines is explained in terms of paging a large spreadsheet with the result reporting which lines were returned and the total, and transcribe is scoped to 'only on an explicit user request' and 'only if no ready transcript exists'. max_chars is only glancingly covered ('Defaults to a readable slice'), which keeps it short of a 5.

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 opens with a specific verb+resource ('Read a document shared in Telegram') and enumerates what it covers: spreadsheets, Word docs, PDFs, text, plus link+metadata for video/audio/image. It explicitly separates itself from search ('This does not search for files by name') and points at the sibling tools used to obtain the identifiers, so an agent can place it against telegram_get_messages and telegram_search_messages without reading schemas.

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?

Prerequisites are stated concretely: locate the message first with telegram_get_messages or telegram_search_messages, and use a message whose message_type is not 'text'. The include_text=false path for metadata-only is implied via the schema rather than called out in prose, and it never says when telegram_get_photo is the better choice for images, so the routing against that sibling is left to inference.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources