Skip to main content
Glama

edit_message

Modify existing Telegram messages by updating text content with support for HTML or Markdown formatting, using the message ID for precise editing.

Instructions

Edit an existing message

Input Schema

NameRequiredDescriptionDefault
message_idYesMessage ID to edit
parse_modeNoParse mode for new text
textYesNew message text

Input Schema (JSON Schema)

{ "properties": { "message_id": { "description": "Message ID to edit", "type": "number" }, "parse_mode": { "description": "Parse mode for new text", "enum": [ "HTML", "Markdown", "MarkdownV2" ], "type": "string" }, "text": { "description": "New message text", "type": "string" } }, "required": [ "message_id", "text" ], "type": "object" }

Implementation Reference

  • The switch case that handles execution of the 'edit_message' tool. It destructures arguments, calls TelegramBot's editMessageText method with chat_id (CHANNEL_ID), message_id, text, and parse_mode, then returns a formatted success response.
    case 'edit_message': { const { message_id, text, parse_mode = 'HTML' } = args as { message_id: number; text: string; parse_mode?: string; }; const result = await bot.editMessageText(text, { chat_id: CHANNEL_ID, message_id, parse_mode: parse_mode as any, }); return { content: [ { type: 'text', text: `โœ… Message edited successfully!\n\n๐Ÿ“ฑ Channel: ${CHANNEL_ID}\n๐Ÿ“ Message ID: ${message_id}\n๐Ÿ“„ New Text: ${text}`, }, ], }; }
  • src/index.ts:151-173 (registration)
    The tool registration entry in the ListToolsRequestSchema response array, defining name, description, and inputSchema for 'edit_message'.
    { name: 'edit_message', description: 'Edit an existing message', inputSchema: { type: 'object', properties: { message_id: { type: 'number', description: 'ID of the message to edit', }, text: { type: 'string', description: 'New message text', }, parse_mode: { type: 'string', enum: ['HTML', 'Markdown'], description: 'Parse mode for the message', }, }, required: ['message_id', 'text'], }, },
  • The input schema definition for the 'edit_message' tool, specifying required message_id and text, optional parse_mode.
    inputSchema: { type: 'object', properties: { message_id: { type: 'number', description: 'ID of the message to edit', }, text: { type: 'string', description: 'New message text', }, parse_mode: { type: 'string', enum: ['HTML', 'Markdown'], description: 'Parse mode for the message', }, }, required: ['message_id', 'text'], },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bobidk91-ops/telegram-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server