send_location
Send geographic coordinates to Telegram chats using latitude and longitude data for location sharing.
Instructions
Send a location to a Telegram chat.
Args: chat_id: Target chat ID. latitude: Latitude of the location. longitude: Longitude of the location. disable_notification: Send silently.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chat_id | Yes | ||
| latitude | Yes | ||
| longitude | Yes | ||
| disable_notification | No |
Implementation Reference
- aiogram_mcp/tools/media.py:471-515 (handler)The handler function `send_location` that implements the tool logic using aiogram's bot.send_location method.
async def send_location( chat_id: int, latitude: float, longitude: float, disable_notification: bool = False, ) -> SendMediaResult: """Send a location to a Telegram chat. Args: chat_id: Target chat ID. latitude: Latitude of the location. longitude: Longitude of the location. 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_location", {"chat_id": chat_id, "latitude": latitude, "longitude": longitude}, result.ok, result.error, ) return result try: if ctx.rate_limiter: await ctx.rate_limiter.acquire() msg = await ctx.bot.send_location( chat_id=chat_id, latitude=latitude, longitude=longitude, disable_notification=disable_notification, ) result = SendMediaResult(ok=True, message_id=msg.message_id, chat_id=msg.chat.id) except (TelegramBadRequest, TelegramForbiddenError) as exc: result = SendMediaResult(ok=False, error=str(exc)) if ctx.audit_logger: ctx.audit_logger.log( "send_location", {"chat_id": chat_id, "latitude": latitude, "longitude": longitude}, result.ok, result.error, ) - aiogram_mcp/tools/media.py:468-470 (registration)Tool registration for `send_location` within the media tools module using the `@mcp.tool` decorator.
if allowed_tools is None or "send_location" in allowed_tools: @mcp.tool