Skip to content

[Feature] pin_message tool — allow bot to pin messages in groups #23

Description

@Rustam-Z

Problem

The bot can send, edit, and delete messages but has no way to pin them. This is useful for:

  • Pinning weekly digest posts so they're visible at the top of the group
  • Pinning important announcements or reminders
  • Any recurring content the operator wants persistent visibility for

Currently a group admin has to pin messages manually after the bot posts them.

Proposed solution

Add a pin_message(chat_id, message_id) MCP tool:

pin_message(chat_id: int, message_id: int, disable_notification: bool = True) -> None

Calls Telegram's pinChatMessage API. Requires the bot to have admin rights with the "Pin Messages" permission in the target group.

Also consider a matching unpin_message(chat_id, message_id) and unpin_all_messages(chat_id) for completeness.

Use case that prompted this

Weekly trend-digest posts fired via a recurring reminder — the bot posts the digest but can't pin it. An admin currently has to pin it manually each Monday.

Notes

  • Bot needs to be promoted to admin with pin permission in each group where this is used
  • disable_notification=True default avoids spamming users with a "message was pinned" notification on every digest
  • Should be listed in --allowedTools like other messaging tools
  • Low risk — pinning is reversible

Requested by

Muhammadjon (group member), approved by Rustam (owner).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions