Skip to main content
Glama
prem-research

Telegram MCP Server

send_message

Send messages to Telegram entities with optional formatting and reply functionality.

Instructions

Send a message to an entity with optional markup and reply

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entity_idYes
contentNo
reply_to_message_idNo

Implementation Reference

  • MCP tool handler for 'send_message': proxies the message sending request to the HTTP API server via POST.
    @mcp.tool(
        name="send_message",
        description="Send a message to an entity with optional markup and reply",
    )
    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()
  • Pydantic input schema for the /send_message HTTP endpoint, matching the MCP tool parameters.
    class SendMessagePost(BaseModel):
        entity: int | str
        content: str
        reply_message_id: int = None
  • HTTP endpoint handler that performs the actual Telegram message sending using the Telethon client.
    @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")
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'optional markup and reply,' hinting at features, but fails to disclose critical traits like required permissions, rate limits, error handling, or whether the operation is idempotent. This leaves significant gaps for a mutation tool.

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?

The description is a single, efficient sentence that front-loads the core action ('Send a message to an entity') and adds brief detail ('with optional markup and reply'). It avoids redundancy and waste, making it appropriately sized for the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's mutation nature, 3 parameters with 0% schema coverage, no annotations, and no output schema, the description is incomplete. It lacks details on behavior, parameter usage, error cases, and return values, making it insufficient for safe and effective agent invocation in this context.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate for undocumented parameters. It adds minimal semantics by noting 'optional markup and reply,' which loosely relates to 'content' and 'reply_to_message_id,' but does not explain parameter meanings, formats, or constraints beyond what the schema titles imply, failing to adequately cover the 3 parameters.

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 states a clear verb ('Send') and resource ('a message to an entity'), specifying the action and target. It distinguishes from sibling tools like 'get_messages' by focusing on sending rather than retrieving, but does not explicitly differentiate from potential other send-related tools (none listed), keeping it at a 4.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives, such as when to send a message vs. retrieve messages or handle entities. It lacks context about prerequisites, timing, or exclusions, offering only basic functional intent without usage scenarios.

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

Install Server

Other 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