Skip to main content
Glama
grammy-mcp
by louietyj

editMessageMedia

Destructive

Edits or replaces media in existing Telegram messages, including photos, videos, documents, audio, animations, and live photos, with album-specific constraints.

Instructions

Use this method to edit animation, audio, document, live photo, photo, or video messages, or to replace a text or a rich message with a media. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo, a live photo, or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.

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

Input Schema

NameRequiredDescriptionDefault
mediaYesAn object for a new media content of the message
chat_idYesUnique identifier for the target chat or username of the target bot, supergroup or channel in the format `@username`
message_idYesIdentifier of the message to edit
reply_markupNoAn object for a new inline keyboard
business_connection_idNoUnique identifier of the business connection on behalf of which the message to be edited was sent

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

Adds substantial behavior beyond the annotations: album-type restrictions, the inline-message rule that only file_id or URL may be used, the distinct return shapes (Message vs True), and the 48-hour limit for business messages not sent by the bot. These are real operational constraints an agent cannot get from destructiveHint/openWorldHint alone.

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 core purpose, then layers album, inline, and business-message caveats in a logical order with no filler. It is long, but each sentence carries a distinct rule; only the return-value sentence borders on routine.

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?

Covers purpose, media-type compatibility, upload restrictions, return values, and time limits, which is the full set of gotchas for a mutation tool with no output schema. The remaining parameter detail (reply_markup replacement, business_connection_id) is adequately documented in the schema.

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 earns above that by clarifying that `media` may reference a previously uploaded file_id or a URL when editing inline messages, a rule the schema's generic 'InputMedia' object does not convey. chat_id, message_id, reply_markup and business_connection_id are left to the schema.

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?

States a specific verb and resource ('edit animation, audio, document, live photo, photo, or video messages') and explicitly extends to replacing text/rich messages with media, which separates it from editMessageText and editMessageCaption. The enumerated media types make the scope unambiguous without opening the schema.

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 concrete when-to-use constraints: album messages can only be edited to a matching media type, and inline messages cannot upload new files. It does not explicitly name sibling alternatives (e.g. editMessageCaption) for caption-only edits, so routing is inferred rather than stated.

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

Deploy Server

Other Tools