Skip to main content
Glama
wowjinxy
by wowjinxy

send_message

Send messages to Discord text channels or threads using this tool, enabling communication within Discord servers through direct message delivery.

Instructions

Send a message to a Discord text channel or thread.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channel_idYes
messageYes

Implementation Reference

  • The main handler function that implements the send_message tool. It fetches the Discord channel by ID, sends the provided content as a message, and returns a confirmation with the channel name and message ID.
    async def handle_send_message(discord_client, arguments: Dict[str, Any]) -> List[TextContent]:
        """Send a message to a channel"""
        channel = await discord_client.fetch_channel(int(arguments["channel_id"]))
        message = await channel.send(arguments["content"])
        
        return [TextContent(
            type="text",
            text=f"Message sent successfully to #{channel.name}. Message ID: {message.id}"
        )]
  • The tool schema definition in the list_tools() function, specifying the input parameters channel_id (string) and content (string) as required for the send_message tool.
        name="send_message",
        description="Send a message to a specific channel",
        inputSchema={
            "type": "object",
            "properties": {
                "channel_id": {
                    "type": "string",
                    "description": "Discord channel ID"
                },
                "content": {
                    "type": "string",
                    "description": "Message content"
                }
            },
            "required": ["channel_id", "content"]
        }
    ),
  • The registration and dispatching logic in the call_tool() function. It checks if the tool name is in core_tool_names (which includes 'send_message') and dynamically calls CoreToolHandlers.handle_send_message.
    core_tool_names = [
        "get_server_info", "list_servers", "get_channels", "list_members",
        "get_user_info", "send_message", "read_messages", "add_reaction",
        "add_multiple_reactions", "remove_reaction", "moderate_message",
        "create_text_channel", "delete_channel", "add_role", "remove_role"
    ]
    
    if name in core_tool_names:
        handler_method = f"handle_{name}"
        if hasattr(CoreToolHandlers, handler_method):
            return await getattr(CoreToolHandlers, handler_method)(discord_client, arguments)
  • Import of the CoreToolHandlers class, which contains the send_message handler, enabling its use in the dispatch logic.
    from .core_tool_handlers import CoreToolHandlers

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