send_animation
Send GIFs or animations to Telegram chats using URLs or file IDs, with optional captions and formatting controls.
Instructions
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.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chat_id | Yes | ||
| animation_url | Yes | ||
| caption | No | ||
| parse_mode | No | HTML | |
| disable_notification | No |
Implementation Reference
- aiogram_mcp/tools/media.py:202-250 (handler)Implementation of the 'send_animation' MCP tool which validates chat permissions, rate limits, and sends a Telegram animation message.
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, - aiogram_mcp/tools/media.py:201-201 (registration)Registration of 'send_animation' as an MCP tool.
@mcp.tool