Skip to main content
Glama
wowjinxy
by wowjinxy

bulk_delete_messages

Remove multiple recent messages from a Discord channel to manage content or perform moderation tasks.

Instructions

Delete multiple recent messages from a channel.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channel_idYes
message_idsNo
limitNo
reasonNo

Implementation Reference

  • The main handler function that executes the bulk delete messages tool. Fetches the channel, purges up to 100 recent messages, and returns a confirmation message.
    async def handle_bulk_delete_messages(discord_client, arguments: Dict[str, Any]) -> List[TextContent]:
        """Bulk delete messages in a channel"""
        channel = await discord_client.fetch_channel(int(arguments["channel_id"]))
        limit = min(arguments["limit"], 100)
        
        deleted = await channel.purge(
            limit=limit,
            reason=arguments.get("reason", "Bulk delete via MCP")
        )
        
        return [TextContent(
            type="text",
            text=f"Deleted {len(deleted)} messages from #{channel.name}\nReason: {arguments.get('reason', 'Bulk delete via MCP')}"
        )]
  • The JSON schema defining the input parameters for the bulk_delete_messages tool: channel_id (required), limit (required, max 100), reason (optional).
    inputSchema={
        "type": "object",
        "properties": {
            "channel_id": {"type": "string", "description": "Channel ID"},
            "limit": {"type": "number", "description": "Number of messages to delete (max 100)"},
            "reason": {"type": "string", "description": "Reason for deletion"}
        },
        "required": ["channel_id", "limit"]
    }
  • The dispatching logic in call_tool that routes 'bulk_delete_messages' to the corresponding handler method in AdvancedToolHandlers class.
    advanced_tool_names = [
        "edit_server_settings", "create_server_template", "create_channel_category",
        "create_voice_channel", "create_stage_channel", "create_forum_channel",
        "create_announcement_channel", "edit_channel", "set_channel_permissions",
        "create_role", "edit_role", "delete_role", "create_role_hierarchy",
        "create_emoji", "create_webhook", "send_webhook_message",
        "ban_member", "kick_member", "timeout_member", "bulk_delete_messages",
        "create_scheduled_event", "create_invite", "create_thread", "create_automod_rule"
    ]
    
    if name in advanced_tool_names:
        handler_method = f"handle_{name}"
        if hasattr(AdvancedToolHandlers, handler_method):
            return await getattr(AdvancedToolHandlers, handler_method)(discord_client, arguments)
  • The Tool object instantiation that registers the bulk_delete_messages tool with MCP framework, including name, description, and schema.
    Tool(
        name="bulk_delete_messages",
        description="Bulk delete messages in a channel",
        inputSchema={
            "type": "object",
            "properties": {
                "channel_id": {"type": "string", "description": "Channel ID"},
                "limit": {"type": "number", "description": "Number of messages to delete (max 100)"},
                "reason": {"type": "string", "description": "Reason for deletion"}
            },
            "required": ["channel_id", "limit"]
        }
    ),

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/wowjinxy/mcp-discord'

If you have feedback or need assistance with the MCP directory API, please join our Discord server