pin_message
Pin important messages in Telegram chats to keep them visible at the top of the conversation. Specify chat and message IDs to organize discussions and highlight key information.
Instructions
Pin a message in a chat.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chat_id | Yes | ||
| message_id | Yes | ||
| disable_notification | No |
Implementation Reference
- aiogram_mcp/tools/messaging.py:225-257 (handler)Implementation of the pin_message tool, which pins a message in a specified chat using the aiogram bot instance.
async def pin_message( chat_id: int, message_id: int, disable_notification: bool = False, ) -> OkResult: """Pin a message in a chat.""" if not ctx.is_chat_allowed(chat_id): result = OkResult(ok=False, error=f"Chat {chat_id} is not allowed.") if ctx.audit_logger: ctx.audit_logger.log( "pin_message", {"chat_id": chat_id, "message_id": message_id}, result.ok, result.error, ) return result try: if ctx.rate_limiter: await ctx.rate_limiter.acquire() await ctx.bot.pin_chat_message( chat_id=chat_id, message_id=message_id, disable_notification=disable_notification, ) result = OkResult(ok=True) except (TelegramBadRequest, TelegramForbiddenError) as exc: result = OkResult(ok=False, error=str(exc)) if ctx.audit_logger: ctx.audit_logger.log( "pin_message", {"chat_id": chat_id, "message_id": message_id},