Skip to main content
Glama
telegram-mcp

telegram-mcp

by Maxsh

get_recent_messages

Retrieve recent messages from a Telegram channel, group, or private chat with date, time, and pagination filters so you can review conversations and detect empty activity windows.

Instructions

Get recent messages from a Telegram channel, group, or private chat. Returns resolved channel info (id/peer/username/type), hasMore/nextOffsetId for pagination, and lastMessageDate so an empty window can be told apart from a dead channel.

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": {
      "channel": "<channel>"
    },
    "name": "get_recent_messages"
  }
}

Input Schema

NameRequiredDescriptionDefault
tzNoIANA time zone used to resolve date-only sinceDate and 'today'/'yesterday' (e.g., Europe/Kyiv). Default: UTC
limitNoNumber of recent messages to retrieve (default: 10, max: 100)
fieldsNoReturn only these per-message fields. Valid: id, date, timestamp, sender, text, messageType, isOutgoing, mediaType, groupedId, link, forwardedFrom, views, replyToMsgId, textTruncated
channelYesChannel username (@channelname), bare numeric id (1496296645), -100-prefixed id (-1001496296645), private chat username (@username), or phone number
offsetIdNoReturn messages older than this message ID (pass nextOffsetId from the previous page to paginate)
sinceDateNoGet messages since this date. Accepts a full ISO datetime (2023-12-01T10:00:00Z), a plain date (2023-12-01, midnight in tz), or 'today' / 'yesterday'
sinceHoursNoGet messages from the last N hours
excludeMediaNoOmit media-only messages (no text and no caption)
sinceMinutesNoGet messages from the last N minutes
maxTextLengthNoTruncate each message text to this many characters (adds textTruncated: true)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changedv0.1.0
    • changedInput schema / properties / channel / description
      Previous value: -"Channel username (@channelname), group username, private chat username (@username), phone number (+1234567890), or chat ID"New value: +"Channel username (@channelname), bare numeric id (1496296645), -100-prefixed id (-1001496296645), private chat username (@username), or phone number"
    • addedInput schema / properties / excludeMedia
      Added value: +{
      +  "description": "Omit media-only messages (no text and no caption)",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / fields
      Added value: +{
      +  "description": "Return only these per-message fields. Valid: id, date, timestamp, sender, text, messageType, isOutgoing, mediaType, groupedId, link, forwardedFrom, views, replyToMsgId, textTruncated",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • addedInput schema / properties / maxTextLength
      Added value: +{
      +  "description": "Truncate each message text to this many characters (adds textTruncated: true)",
      +  "minimum": 1,
      +  "type": "number"
      +}
    • addedInput schema / properties / offsetId
      Added value: +{
      +  "description": "Return messages older than this message ID (pass nextOffsetId from the previous page to paginate)",
      +  "type": "number"
      +}
    • changedInput schema / properties / sinceDate / description
      Previous value: -"Get messages since this date (ISO format: 2023-12-01T10:00:00Z)"New value: +"Get messages since this date. Accepts a full ISO datetime (2023-12-01T10:00:00Z), a plain date (2023-12-01, midnight in tz), or 'today' / 'yesterday'"
    • addedInput schema / properties / tz
      Added value: +{
      +  "description": "IANA time zone used to resolve date-only sinceDate and 'today'/'yesterday' (e.g., Europe/Kyiv). Default: UTC",
      +  "type": "string"
      +}
  2. First observedv1.0.0

TDQS

A3.6/5.0
Behavior3/5

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

With no annotations supplied, the description must carry the full behavioral burden. It does add real value by disclosing the return shape (resolved channel info, hasMore/nextOffsetId, lastMessageDate) and the non-obvious edge case of an empty window versus a dead channel. It says nothing about authentication requirements, rate limits, or whether reads have side effects such as marking messages read, which is notable given the sibling mark_messages_read exists.

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

Conciseness5/5

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

Two dense sentences with no filler. The primary action is front-loaded and the return-value sentence is compact and informative, with each clause earning its place.

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 10-parameter read tool with no output schema, the description adequately covers what comes back and how to page through it. Because the schema is fully documented, the remaining reliance on the schema for date-filter semantics and field projection is acceptable, though a note on which URL/identifier forms resolve for 'channel' would round it out.

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

Parameters3/5

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

Schema description coverage is 100%, so every parameter is already documented in the schema. The description only adds connective meaning by tying offsetId to the returned nextOffsetId for pagination; it does not clarify the precedence between sinceDate, sinceHours, and sinceMinutes or the interaction between fields, excludeMedia, and maxTextLength.

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 description opens with a specific verb+resource ("Get recent messages from a Telegram channel, group, or private chat") and states the scope of sources it covers. However, it never distinguishes itself from siblings such as get_private_messages, get_messages_multi, or search_messages, so the agent must infer which retrieval tool fits which case.

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

Usage Guidelines3/5

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

There is an implicit usage hint in the pagination clause ("pass nextOffsetId from the previous page") and an interpretive hint that lastMessageDate lets you tell an empty window from a dead channel. But there is no explicit when-to-use guidance, no when-not-to-use, and no named alternative for filtered or multi-channel retrieval.

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