Skip to main content
Glama
jar285

MCP-Discord

by jar285

discord_send

Send messages directly to a Discord text channel using MCP-Discord server. Input channel ID and message content to enable AI assistants to communicate on Discord platforms efficiently.

Instructions

Sends a message to a specified Discord text channel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channelIdYes
messageYes

Implementation Reference

  • Handler for the 'discord_send' tool. Validates input using SendMessageSchema, fetches the Discord text channel, sends the message, and returns success or error response.
    case "discord_send": { // Use default channel ID if not provided let parsedArgs = SendMessageSchema.parse(args); if (parsedArgs.channelId === 'default') { parsedArgs.channelId = process.env.DEFAULT_CHANNEL_ID || ''; } const { channelId, message } = parsedArgs; try { if (!client.isReady()) { return { content: [{ type: "text", text: "Discord client not logged in. Please use discord_login tool first." }], isError: true }; } const channel = await client.channels.fetch(channelId); if (!channel || !(channel instanceof TextChannel)) { return { content: [{ type: "text", text: `Cannot find text channel with ID: ${channelId}` }], isError: true }; } await channel.send(message); return { content: [{ type: "text", text: `Message sent to channel: ${channel.name}` }] }; } catch (error) { return { content: [{ type: "text", text: `Send message failed: ${error}` }], isError: true }; } }
  • Zod schema defining the input parameters for the discord_send tool: channelId (string) and message (string). Used for validation in the handler.
    const SendMessageSchema = z.object({ channelId: z.string(), message: z.string()
  • src/index.ts:215-226 (registration)
    Registration of the 'discord_send' tool in the ListTools response, including name, description, and input schema matching the Zod schema.
    { name: "discord_send", description: "Sends a message to a specified Discord text channel", inputSchema: { type: "object", properties: { channelId: { type: "string" }, message: { type: "string" } }, required: ["channelId", "message"] } },

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/jar285/mcp-discord'

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