send_video
Send a video to a Telegram chat by URL or file ID with optional caption, parse mode, duration, and silent notification.
Instructions
Send a video to a Telegram chat.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chat_id | Yes | Target chat ID. | |
| video_url | Yes | URL or file_id of the video. | |
| caption | No | Optional caption. | |
| parse_mode | No | HTML, Markdown, MarkdownV2, or None. | HTML |
| duration | No | Duration in seconds. | |
| disable_notification | No | Send silently. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | ||
| error | No | ||
| message_id | No | ||
| chat_id | No |
Implementation Reference
- aiogram_mcp/tools/media.py:144-197 (handler)The send_video tool handler function. Takes chat_id, video_url, caption, parse_mode, duration, disable_notification. Sends a video via ctx.bot.send_video() and returns a SendMediaResult.
async def send_video( chat_id: int, video_url: str, caption: str | None = None, parse_mode: str | None = "HTML", duration: int | None = None, disable_notification: bool = False, ) -> SendMediaResult: """Send a video to a Telegram chat. Args: chat_id: Target chat ID. video_url: URL or file_id of the video. caption: Optional caption. parse_mode: HTML, Markdown, MarkdownV2, or None. duration: Duration in seconds. 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_video", {"chat_id": chat_id, "video_url": video_url}, result.ok, result.error, ) return result try: if ctx.rate_limiter: await ctx.rate_limiter.acquire() msg = await ctx.bot.send_video( chat_id=chat_id, video=video_url, caption=caption, parse_mode=normalize_parse_mode(parse_mode), duration=duration, 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_video", {"chat_id": chat_id, "video_url": video_url}, result.ok, result.error, ) return result - aiogram_mcp/tools/media.py:14-16 (schema)SendMediaResult model used as the return type for send_video (message_id, chat_id fields).
class SendMediaResult(ToolResponse): message_id: int | None = None chat_id: int | None = None - aiogram_mcp/tools/media.py:141-166 (registration)Guard clause checking allowed_tools for 'send_video', and @mcp.tool decorator that registers the tool with FastMCP.
if allowed_tools is None or "send_video" in allowed_tools: @mcp.tool async def send_video( chat_id: int, video_url: str, caption: str | None = None, parse_mode: str | None = "HTML", duration: int | None = None, disable_notification: bool = False, ) -> SendMediaResult: """Send a video to a Telegram chat. Args: chat_id: Target chat ID. video_url: URL or file_id of the video. caption: Optional caption. parse_mode: HTML, Markdown, MarkdownV2, or None. duration: Duration in seconds. 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_video", - aiogram_mcp/server.py:102-102 (registration)Top-level registration call: register_media_tools(self._mcp, self._ctx, allowed_tools=at) triggers registration of send_video.
register_media_tools(self._mcp, self._ctx, allowed_tools=at) - aiogram_mcp/permissions.py:33-33 (helper)Permission mapping: 'send_video' is at PermissionLevel.MESSAGING level.
"send_video": PermissionLevel.MESSAGING,