unpin_message
Remove a pinned message from a Discord channel to manage pinned content and maintain channel organization.
Instructions
Unpin a message in a text channel.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channel_id | Yes | ||
| message_id | Yes | ||
| reason | No |
Implementation Reference
- src/discord_mcp/server.py:768-777 (handler)Implements the unpin_message tool: fetches the specified channel and message, then calls Discord's message.unpin() method. Also serves as registration via @server.tool() decorator.@server.tool() async def unpin_message(channel_id: str | int, message_id: str | int, reason: str | None = None, ctx: Context = None) -> str: # type: ignore[override] """Unpin a message in a text channel.""" assert ctx is not None bot, _ = await _acquire(ctx) channel = await _ensure_channel(bot, _require_int(channel_id, "channel_id")) message = await _fetch_message(channel, _require_int(message_id, "message_id")) await _call_discord("unpin message", message.unpin(reason=reason)) return f"Unpinned message {message.id} in channel {channel.id}."