Skip to main content
Glama
jar285

MCP-Discord

by jar285

discord_create_webhook

Create a new webhook for a Discord channel using the MCP-Discord server, enabling automated message delivery and integration for streamlined communication.

Instructions

Creates a new webhook for a Discord channel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
avatarNo
channelIdYes
nameYes
reasonNo

Implementation Reference

  • Handler that executes the discord_create_webhook tool: validates input, fetches channel, creates webhook using Discord.js channel.createWebhook method, returns webhook ID and token.
    case "discord_create_webhook": { const { channelId, name, avatar, reason } = CreateWebhookSchema.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 channel = await client.channels.fetch(channelId); if (!channel || !channel.isTextBased()) { return { content: [{ type: "text", text: `Cannot find text channel with ID: ${channelId}` }], isError: true }; } // Check if the channel supports webhooks if (!('createWebhook' in channel)) { return { content: [{ type: "text", text: `Channel type does not support webhooks: ${channelId}` }], isError: true }; } // Create the webhook const webhook = await channel.createWebhook({ name: name, avatar: avatar, reason: reason }); return { content: [{ type: "text", text: `Successfully created webhook with ID: ${webhook.id} and token: ${webhook.token}` }] }; } catch (error) { return { content: [{ type: "text", text: `Failed to create webhook: ${error}` }], isError: true }; } }
  • Zod schema defining input parameters for the discord_create_webhook tool: channelId (required), name (required), avatar (optional), reason (optional). Used for validation in handler and inputSchema in registration.
    const CreateWebhookSchema = z.object({ channelId: z.string(), name: z.string(), avatar: z.string().optional(), reason: z.string().optional() });
  • src/index.ts:399-412 (registration)
    Tool registration in the ListTools response: defines name, description, and inputSchema matching the CreateWebhookSchema.
    { name: "discord_create_webhook", description: "Creates a new webhook for a Discord channel", inputSchema: { type: "object", properties: { channelId: { type: "string" }, name: { type: "string" }, avatar: { type: "string" }, reason: { type: "string" } }, required: ["channelId", "name"] } },

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