Skip to main content
Glama

send_animation

Send a GIF or animation to a Telegram chat using a URL or file ID, with optional caption and notification settings.

Instructions

Send a GIF/animation to a Telegram chat.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chat_idYesTarget chat ID.
animation_urlYesURL or file_id of the animation.
captionNoOptional caption.
parse_modeNoHTML, Markdown, MarkdownV2, or None.HTML
disable_notificationNoSend silently.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYes
errorNo
message_idNo
chat_idNo

Implementation Reference

  • The main handler function for the 'send_animation' tool. It validates chat access, enforces rate limiting, calls bot.send_animation with the provided parameters, handles errors, and logs the outcome.
    async def send_animation(
        chat_id: int,
        animation_url: str,
        caption: str | None = None,
        parse_mode: str | None = "HTML",
        disable_notification: bool = False,
    ) -> SendMediaResult:
        """Send a GIF/animation to a Telegram chat.
    
        Args:
            chat_id: Target chat ID.
            animation_url: URL or file_id of the animation.
            caption: Optional caption.
            parse_mode: HTML, Markdown, MarkdownV2, or None.
            disable_notification: Send silently.
        """
        if not ctx.is_chat_allowed(chat_id):
            result = SendMediaResult(ok=False, error=f"Chat {chat_id} is not allowed.")
            if ctx.audit_logger:
                ctx.audit_logger.log(
                    "send_animation",
                    {"chat_id": chat_id, "animation_url": animation_url},
                    result.ok,
                    result.error,
                )
            return result
    
        try:
            if ctx.rate_limiter:
                await ctx.rate_limiter.acquire()
            msg = await ctx.bot.send_animation(
                chat_id=chat_id,
                animation=animation_url,
                caption=caption,
                parse_mode=normalize_parse_mode(parse_mode),
                disable_notification=disable_notification,
            )
            result = SendMediaResult(ok=True, message_id=msg.message_id, chat_id=msg.chat.id)
        except ValueError as exc:
            result = SendMediaResult(ok=False, error=str(exc))
        except (TelegramBadRequest, TelegramForbiddenError) as exc:
            result = SendMediaResult(ok=False, error=str(exc))
    
        if ctx.audit_logger:
            ctx.audit_logger.log(
                "send_animation",
                {"chat_id": chat_id, "animation_url": animation_url},
                result.ok,
                result.error,
            )
        return result
  • SendMediaResult model used as the return type for send_animation.
    class SendMediaResult(ToolResponse):
        message_id: int | None = None
        chat_id: int | None = None
  • The register_media_tools function that registers send_animation (and other media tools) via @mcp.tool decorator.
    def register_media_tools(
        mcp: FastMCP, ctx: BotContext, allowed_tools: set[str] | None = None
    ) -> None:
  • The call site where register_media_tools is invoked, which registers send_animation as an MCP tool.
    register_media_tools(self._mcp, self._ctx, allowed_tools=at)
  • Permission level mapping for send_animation, set to MESSAGING.
    "send_animation": PermissionLevel.MESSAGING,
Behavior1/5

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

With no annotations, the description carries full behavioral disclosure burden. It only states 'Send a GIF/animation' without any information on side effects, permission requirements, error handling, or chat constraints. This is insufficient 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.

Conciseness3/5

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

The description is a single concise sentence, but its brevity sacrifices necessary detail. It is minimal but not efficient in conveying comprehensive information.

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?

The tool has 5 parameters and no annotations. The description only covers the core action, ignoring optional parameters like caption and disable_notification. The output schema exists but is not referenced, leaving the return value ambiguous. The description is incomplete for a media-sending tool.

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

Parameters3/5

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

Schema coverage is 100% with descriptions for all 5 parameters. The tool description does not add extra context beyond the schema (e.g., valid animation_url formats, behavior of parse_mode). Baseline 3 is appropriate as the schema does the heavy lifting.

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 explicitly states 'Send a GIF/animation to a Telegram chat,' clearly identifying the verb (send) and resource (GIF/animation). Among sibling tools like send_photo, send_video, and send_sticker, this description effectively distinguishes the tool's purpose for animations.

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 (e.g., send_video for videos, send_photo for images) or any prerequisites (e.g., file format, size limits). The agent lacks context for appropriate selection.

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