Skip to main content
Glama
prem-research

Telegram MCP Server

send_message

Send messages to Telegram entities with optional markup and reply functionality, enabling clear and structured communication via the Telegram MCP Server.

Instructions

Send a message to an entity with optional markup and reply

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentNo
entity_idYes
reply_to_message_idNo

Implementation Reference

  • MCP tool handler for 'send_message' that makes a POST request to the HTTP API endpoint to send the message.
    async def send_message( entity_id: int | str, content: str = "", reply_to_message_id: int = None, ) -> dict: return post( f"{api_endpoint}send_message", json={ "entity": entity_id, "content": content, "reply_to_message_id": reply_to_message_id, }, headers={"Content-Type": "application/json"}, ).json()
  • Registration of the 'send_message' MCP tool using the @mcp.tool decorator.
    @mcp.tool( name="send_message", description="Send a message to an entity with optional markup and reply", )
  • Pydantic schema (BaseModel) for the input parameters of the send_message HTTP endpoint, matching the MCP tool parameters.
    class SendMessagePost(BaseModel): entity: int | str content: str reply_message_id: int = None
  • HTTP POST endpoint handler for send_message that executes the actual Telegram client.send_message call.
    @app.post("/send_message") async def send_message(post_msg: SendMessagePost): e_obj = await get_entity(entity=post_msg.entity, raw=True) message = await client.send_message( entity=e_obj, message=post_msg.content, reply_to=post_msg.reply_message_id, parse_mode="html", ) if isinstance(message, types.Message) and message.id: return {"message_id": message.id} else: raise HTTPException(status_code=404, detail="Error sending message")

Other Tools

Related Tools

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/prem-research/telegram-mcp'

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