Skip to main content
Glama
telegram-archive-mcp

telegram-archive-mcp

by GeiserX

Read a chat's messages

get_messages
Read-onlyIdempotent

Retrieve messages from a Telegram chat newest first, page older history with offset or date/id cursor, filter by forum topic, and fetch messages after an id for incremental browsing.

Instructions

Get messages from a Telegram chat, newest first. Page with offset, or with the keyset cursor: pass the date and id of the last message you received as before_date and before_id to get the older ones (constant time on huge chats). after_id returns the messages right after an id. Dates are naive UTC. Each message carries reply_to_msg_id and, when it has a file, media (pass its id to get_media).

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>"
    },
    "name": "get_messages"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNoMaximum messages to return, 1 to 500 (default 50).
offsetNoMessages to skip, 0 to 100000 (default 0). Slow deep into a long chat; ignored when a cursor is given.
chat_idYesThe chat's ref, as list_chats or search_all_chats returns it (an opaque string; not the numeric Telegram id).
after_idNoReturns the messages right after this message id (newer), still newest first.
topic_idNoForum topic id from get_topics; keeps only that topic's messages. 1 is the General topic. Omit for the whole chat.
before_idNoKeyset cursor: message id. Returns messages with a smaller id; pair with before_date.
before_dateNoKeyset cursor: ISO 8601 date-time, naive values are UTC (e.g. 2026-06-10T18:04:17). Returns messages older than this instant; pair with before_id.

Output Schema

NameRequiredDescriptionDefault
messagesNoArchived messages as the viewer returns them: id, date (naive UTC), text, sender fields, reply_to_msg_id, media and more.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed20 schema fields changedv0.4.1
    • addedInput schema / additionalProperties
      Added value: +false
    • changedInput schema / properties / after_id / description
      Previous value: -"Returns messages with an id greater than this one (newer)."New value: +"Returns the messages right after this message id (newer), still newest first."
    • addedInput schema / properties / after_id / minimum
      Added value: +0
    • changedInput schema / properties / after_id / type
      Previous value: -"number"New value: +"integer"
    • addedInput schema / properties / before_id / minimum
      Added value: +0
    • changedInput schema / properties / before_id / type
      Previous value: -"number"New value: +"integer"
    • changedInput schema / properties / chat_id / description
      Previous value: -"Chat ID to retrieve messages from"New value: +"The chat's ref, as list_chats or search_all_chats returns it (an opaque string; not the numeric Telegram id)."
    • addedInput schema / properties / chat_id / minLength
      Added value: +1
    • addedInput schema / properties / limit / default
      Added value: +50
    • changedInput schema / properties / limit / description
      Previous value: -"Maximum messages to return (default 50, max 500)"New value: +"Maximum messages to return, 1 to 500 (default 50)."
    • addedInput schema / properties / limit / maximum
      Added value: +500
    • addedInput schema / properties / limit / minimum
      Added value: +1
    • changedInput schema / properties / limit / type
      Previous value: -"number"New value: +"integer"
    • addedInput schema / properties / offset / default
      Added value: +0
    • changedInput schema / properties / offset / description
      Previous value: -"Pagination offset (default 0). Ignored when a cursor is given."New value: +"Messages to skip, 0 to 100000 (default 0). Slow deep into a long chat; ignored when a cursor is given."
    • addedInput schema / properties / offset / maximum
      Added value: +100000
    • addedInput schema / properties / offset / minimum
      Added value: +0
    • changedInput schema / properties / offset / type
      Previous value: -"number"New value: +"integer"
    • addedInput schema / properties / topic_id
      Added value: +{
      +  "description": "Forum topic id from get_topics; keeps only that topic's messages. 1 is the General topic. Omit for the whole chat.",
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "messages": {
      +      "description": "Archived messages as the viewer returns them: id, date (naive UTC), text, sender fields, reply_to_msg_id, media and more.",
      +      "items": {
      +        "type": "object"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "type": "object"
      +}
  2. Changed5 schema fields changedv0.1.3
    • addedInput schema / properties / after_id
      Added value: +{
      +  "description": "Returns messages with an id greater than this one (newer).",
      +  "type": "number"
      +}
    • addedInput schema / properties / before_date
      Added value: +{
      +  "description": "Keyset cursor: ISO 8601 date-time, naive values are UTC (e.g. 2026-06-10T18:04:17). Returns messages older than this instant; pair with before_id.",
      +  "type": "string"
      +}
    • addedInput schema / properties / before_id
      Added value: +{
      +  "description": "Keyset cursor: message id. Returns messages with a smaller id; pair with before_date.",
      +  "type": "number"
      +}
    • changedInput schema / properties / limit / description
      Previous value: -"Maximum messages to return (default 50)"New value: +"Maximum messages to return (default 50, max 500)"
    • changedInput schema / properties / offset / description
      Previous value: -"Pagination offset (default 0)"New value: +"Pagination offset (default 0). Ignored when a cursor is given."
  3. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already cover the read-only, idempotent safety profile, and the description adds real context beyond that: result ordering, the performance characteristic of keyset pagination, exclusion of offset when a cursor is supplied, and that dates are naive UTC. It stops short of describing limits or what happens on an invalid chat_id, but the additions are substantive.

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?

Front-loads the resource and ordering, then moves straight into paging mechanics; nearly every clause carries information. It is a dense block of cursor jargon that could be broken up, but nothing is filler.

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?

An output schema exists, so return values need not be spelled out, yet the description usefully flags reply_to_msg_id and media. Ordering, both paging modes, date semantics, and the downstream link to get_media are all covered for a 7-parameter read tool.

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; the description still adds value by explaining that before_date and before_id must be paired as a cursor, that after_id returns messages newer than the given id, and by pointing at get_media for the media id. That is genuine semantic detail beyond the field descriptions.

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?

Opens with a specific verb and resource ("get messages from a Telegram chat") and states ordering (newest first), so the agent knows exactly what is returned. It does not differentiate itself from close siblings such as get_messages_by_date or search_messages, so it falls short of 5.

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?

Gives clear guidance on the two paging strategies (offset vs. keyset cursor) and when the cursor is preferable ("constant time on huge chats"). It never states when to prefer a sibling like get_messages_by_date or search_messages, so there are no explicit exclusions.

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