Skip to main content
Glama

forward_message

Forward an existing message from one chat to another by specifying source chat, message ID, and target chat.

Instructions

Forward an existing message from one chat to another.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
to_chat_idYes
from_chat_idYes
message_idYes
disable_notificationNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYes
errorNo
message_idNo

Implementation Reference

  • The forward_message tool handler function. It checks chat permissions, applies rate limiting, calls ctx.bot.forward_message(), and logs the result via audit_logger.
    if allowed_tools is None or "forward_message" in allowed_tools:
    
        @mcp.tool
        async def forward_message(
            to_chat_id: int,
            from_chat_id: int,
            message_id: int,
            disable_notification: bool = False,
        ) -> ForwardMessageResult:
            """Forward an existing message from one chat to another."""
            if not ctx.is_chat_allowed(to_chat_id):
                result = ForwardMessageResult(
                    ok=False, error=f"Chat {to_chat_id} is not allowed."
                )
                if ctx.audit_logger:
                    ctx.audit_logger.log(
                        "forward_message",
                        {
                            "to_chat_id": to_chat_id,
                            "from_chat_id": from_chat_id,
                            "message_id": message_id,
                        },
                        result.ok,
                        result.error,
                    )
                return result
    
            try:
                if ctx.rate_limiter:
                    await ctx.rate_limiter.acquire()
                msg = await ctx.bot.forward_message(
                    chat_id=to_chat_id,
                    from_chat_id=from_chat_id,
                    message_id=message_id,
                    disable_notification=disable_notification,
                )
                result = ForwardMessageResult(ok=True, message_id=msg.message_id)
            except (TelegramBadRequest, TelegramForbiddenError) as exc:
                result = ForwardMessageResult(ok=False, error=str(exc))
    
            if ctx.audit_logger:
                ctx.audit_logger.log(
                    "forward_message",
                    {
                        "to_chat_id": to_chat_id,
                        "from_chat_id": from_chat_id,
                        "message_id": message_id,
                    },
                    result.ok,
                    result.error,
                )
            return result
  • ForwardMessageResult Pydantic model: returns ok/error and optional message_id.
    class ForwardMessageResult(ToolResponse):
        message_id: int | None = None
  • register_messaging_tools function that registers forward_message as an MCP tool via @mcp.tool decorator. Called from server.py line 88.
    def register_messaging_tools(
        mcp: FastMCP, ctx: BotContext, allowed_tools: set[str] | None = None
    ) -> None:
  • The _register_tools method in the server that calls register_messaging_tools to register all messaging tools including forward_message.
    def _register_tools(self) -> None:
        at = self._allowed_tools
        register_messaging_tools(self._mcp, self._ctx, allowed_tools=at)
  • Permission mapping: 'forward_message' is assigned PermissionLevel.MESSAGING.
    "forward_message": PermissionLevel.MESSAGING,
Behavior2/5

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

With no annotations, the description must carry the burden of behavioral disclosure. It only states the basic operation, omitting details on permissions, error handling, or side effects (e.g., message remains in source chat).

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

Conciseness3/5

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

The description is a single sentence, making it very concise, but it lacks any additional helpful structure such as parameter details or usage examples. It could be expanded without losing conciseness.

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 presence of an output schema and 4 uncommented parameters, the description is insufficient. It does not explain return values, parameter constraints, or typical use cases, leaving significant gaps for an agent.

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

Parameters1/5

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

The schema has 0% description coverage, and the description does not elaborate on any parameter meanings (e.g., disable_notification, to_chat_id). It relies entirely on parameter names, which may be ambiguous.

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?

The description clearly states the action (forward), the resource (existing message), and the scope (from one chat to another). It effectively distinguishes this from sibling tools like send_message.

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?

No guidance is provided on when to use this tool versus alternatives like send_message or other forwarding mechanisms. No exclusions or context are mentioned.

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/Py2755/aiogram-mcp'

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