Skip to main content
Glama

discord_send_webhook_message

Send messages to a Discord channel using a webhook. Configure webhook details, content, username, avatar, and thread ID for precise message delivery.

Instructions

Sends a message to a Discord channel using a webhook

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
avatarURLNo
contentYes
threadIdNo
usernameNo
webhookIdYes
webhookTokenYes

Implementation Reference

  • The core handler function that validates input using SendWebhookMessageSchema, fetches the Discord webhook, sends the message with provided content and options, handles errors, and returns appropriate ToolResponse.
    export async function sendWebhookMessageHandler(
      args: unknown, 
      context: ToolContext
    ): Promise<ToolResponse> {
      const { webhookId, webhookToken, content, username, avatarURL, threadId } = SendWebhookMessageSchema.parse(args);
      try {
        if (!context.client.isReady()) {
          return {
            content: [{ type: "text", text: "Discord client not logged in." }],
            isError: true
          };
        }
    
        const webhook = await context.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 handleDiscordError(error);
      }
    }
  • src/server.ts:168-171 (registration)
    Switch case in server that registers and dispatches calls to the sendWebhookMessageHandler function.
    case "discord_send_webhook_message":
      this.logClientState("before discord_send_webhook_message handler");
      toolResponse = await sendWebhookMessageHandler(args, this.toolContext);
      return toolResponse;
  • MCP tool definition including name, description, and input schema for registration in the tool list.
    {
      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"]
      }
    },
  • Zod validation schema for the tool inputs, used inside the handler for parsing arguments.
    export 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()
    });
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the basic action without disclosing behavioral traits. It doesn't mention whether this is a read/write operation (implied write from 'sends'), error conditions, rate limits, authentication needs beyond parameters, or what happens on success/failure. This is inadequate for a tool with mutation potential.

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 front-loads the core purpose without unnecessary words. Every part earns its place, though it could benefit from additional context given the complexity.

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 tool with 6 parameters, no annotations, no output schema, and 0% schema coverage, the description is incomplete. It doesn't address parameter meanings, behavioral expectations, or output format, leaving the agent with insufficient context to use the tool effectively beyond basic inference.

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 description must compensate but adds no parameter information beyond what's implied in the name. It doesn't explain what webhookId/webhookToken are, how content is formatted, or optional parameters like avatarURL/username/threadId. With 6 parameters (3 required) completely undocumented, this is a significant gap.

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 ('sends a message') and resource ('to a Discord channel using a webhook'), making the purpose immediately understandable. It distinguishes from sibling tools like discord_send (which likely uses different authentication) by specifying the webhook method, though it doesn't explicitly contrast with all alternatives.

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 like discord_send or discord_create_webhook. It doesn't mention prerequisites (e.g., needing a pre-configured webhook) or contextual constraints, leaving the agent to infer usage from the tool name alone.

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