Skip to main content
Glama

discord_create_webhook

Create a Discord webhook to automate messages in a specific channel by providing a channel ID and webhook name using the MCP-Discord server.

Instructions

Creates a new webhook for a Discord channel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
avatarNo
channelIdYes
nameYes
reasonNo

Implementation Reference

  • The primary handler function implementing the discord_create_webhook tool. It validates input with Zod, fetches the Discord channel, verifies webhook support, creates the webhook using discord.js, and returns the webhook ID and token on success or appropriate error.
    export async function createWebhookHandler(
      args: unknown, 
      context: ToolContext
    ): Promise<ToolResponse> {
      const { channelId, name, avatar, reason } = CreateWebhookSchema.parse(args);
      try {
        if (!context.client.isReady()) {
          return {
            content: [{ type: "text", text: "Discord client not logged in." }],
            isError: true
          };
        }
    
        const channel = await context.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 handleDiscordError(error);
      }
    }
  • src/server.ts:163-166 (registration)
    Tool dispatch/registration in the MCP server request handler switch statement, calling the createWebhookHandler with parsed arguments and tool context.
    case "discord_create_webhook":
      this.logClientState("before discord_create_webhook handler");
      toolResponse = await createWebhookHandler(args, this.toolContext);
      return toolResponse;
  • MCP tool metadata including name, description, and JSON schema for input validation, used in listTools response.
    {
      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"]
      }
    },
  • Zod schema for input validation used within the handler to parse and type-check arguments.
    export const CreateWebhookSchema = z.object({
        channelId: z.string(),
        name: z.string(),
        avatar: z.string().optional(),
        reason: z.string().optional()
    });
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is a creation operation, implying mutation, but doesn't cover permissions needed, rate limits, whether it's idempotent, or what the response contains (e.g., webhook URL). This is inadequate for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with 4 parameters (2 required), 0% schema coverage, no annotations, and no output schema, the description is incomplete. It doesn't explain parameters, behavioral traits, or return values, leaving significant gaps for the agent to operate effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the schema provides no parameter documentation. The description mentions no parameters at all, failing to explain what 'channelId', 'name', 'avatar', or 'reason' mean or how they're used. This leaves all 4 parameters (2 required) semantically undefined.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Creates') and resource ('a new webhook for a Discord channel'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling tools like discord_edit_webhook or discord_delete_webhook, which would require mentioning it's specifically for creation rather than modification or deletion.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing channel access), when not to use it (e.g., for existing webhooks), or refer to sibling tools like discord_edit_webhook for updates, leaving the agent to infer usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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

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