Skip to main content
Glama
jar285

MCP-Discord

by jar285

discord_send_webhook_message

Sends messages to Discord channels using webhooks by specifying webhook ID, token, and content. Supports custom usernames, avatars, and thread targeting.

Instructions

Sends a message to a Discord channel using a webhook

Input Schema

NameRequiredDescriptionDefault
avatarURLNo
contentYes
threadIdNo
usernameNo
webhookIdYes
webhookTokenYes

Input Schema (JSON Schema)

{ "properties": { "avatarURL": { "type": "string" }, "content": { "type": "string" }, "threadId": { "type": "string" }, "username": { "type": "string" }, "webhookId": { "type": "string" }, "webhookToken": { "type": "string" } }, "required": [ "webhookId", "webhookToken", "content" ], "type": "object" }

Implementation Reference

  • Executes the tool logic: validates input, fetches Discord webhook, sends message with optional username, avatarURL, threadId.
    case "discord_send_webhook_message": { const { webhookId, webhookToken, content, username, avatarURL, threadId } = SendWebhookMessageSchema.parse(args); try { if (!client.isReady()) { return { content: [{ type: "text", text: "Discord client not logged in. Please use discord_login tool first." }], isError: true }; } const webhook = await client.fetchWebhook(webhookId, webhookToken); if (!webhook) { return { content: [{ type: "text", text: `Cannot find webhook with ID: ${webhookId}` }], isError: true }; } // Send the message await webhook.send({ content: content, username: username, avatarURL: avatarURL, threadId: threadId }); return { content: [{ type: "text", text: `Successfully sent webhook message to webhook ID: ${webhookId}` }] }; } catch (error) { return { content: [{ type: "text", text: `Failed to send webhook message: ${error}` }], isError: true }; } }
  • Zod input schema for validating tool arguments: webhookId, webhookToken, content (required); username, avatarURL, threadId (optional).
    const SendWebhookMessageSchema = z.object({ webhookId: z.string(), webhookToken: z.string(), content: z.string(), username: z.string().optional(), avatarURL: z.string().optional(), threadId: z.string().optional() });
  • src/index.ts:413-428 (registration)
    Registers the tool in the MCP server's listTools handler with name, description, and input schema.
    { name: "discord_send_webhook_message", description: "Sends a message to a Discord channel using a webhook", inputSchema: { type: "object", properties: { webhookId: { type: "string" }, webhookToken: { type: "string" }, content: { type: "string" }, username: { type: "string" }, avatarURL: { type: "string" }, threadId: { type: "string" } }, required: ["webhookId", "webhookToken", "content"] } },

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