Skip to main content
Glama
jar285

MCP-Discord

by jar285

discord_send_webhook_message

Send messages to Discord channels using webhooks for automated notifications and bot integration.

Instructions

Sends a message to a Discord channel using a webhook

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
webhookIdYes
webhookTokenYes
contentYes
usernameNo
avatarURLNo
threadIdNo

Implementation Reference

  • Handler function in the tool execution switch statement. Parses arguments with Zod schema, fetches Discord webhook using client.fetchWebhook, sends message via webhook.send with provided parameters, handles errors and client readiness.
    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: requires webhookId, webhookToken, content; optional username, avatarURL, threadId.
    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:414-428 (registration)
    Tool registration object in the ListTools handler's tools array, defining name, description, and JSON input schema matching the Zod 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