Skip to main content
Glama

discord_send_webhook_message

Send automated messages to Discord channels using webhooks for notifications, alerts, or bot communications.

Instructions

Sends a message to a Discord channel using a webhook

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
webhookIdYes
webhookTokenYes
contentYes
usernameNo
avatarURLNo
threadIdNo

Implementation Reference

  • Executes the Discord webhook message sending logic: parses input with SendWebhookMessageSchema, fetches webhook, sends message with options, handles errors.
    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,
          username,
          avatarURL,
          threadId,
        });
    
        return {
          content: [
            {
              type: 'text',
              text: `Successfully sent webhook message to webhook ID: ${webhookId}`,
            },
          ],
        };
      } catch (error) {
        return handleDiscordError(error);
      }
    }
  • Zod schema for input validation of the tool parameters: webhookId, webhookToken, content (required), and optional username, avatarURL, threadId.
    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(),
    });
  • MCP tool registration entry in the toolList array, defining name, description, and inputSchema 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'],
      },
    },
  • src/server.ts:191-197 (registration)
    Dispatch/registration in server request handler switch statement: calls sendWebhookMessageHandler with parsed args and tool context.
    case 'discord_send_webhook_message':
      this.logClientState('before discord_send_webhook_message handler');
      toolResponse = await sendWebhookMessageHandler(
        args,
        this.toolContext
      );
      return toolResponse;
  • Re-export of the sendWebhookMessageHandler (and related webhook handlers) for convenient import in server.ts and transport.ts.
    createWebhookHandler,
    deleteWebhookHandler,
    editWebhookHandler,
    sendWebhookMessageHandler,
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 the action ('sends a message') which implies a write operation, but doesn't disclose any behavioral traits like rate limits, permissions required, whether messages are editable/deletable, error conditions, or response format. The description is minimal and lacks crucial operational context.

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 states the core functionality without unnecessary words. It's appropriately sized for the basic operation described and front-loads the essential information. Every word earns its place in this minimal description.

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?

Given the complexity (6 parameters, 3 required), no annotations, no output schema, and 0% schema description coverage, the description is inadequate. It doesn't explain parameter meanings, behavioral aspects, error handling, or what constitutes successful execution. For a tool that performs a write operation with multiple configuration options, this minimal description leaves too many gaps.

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

Parameters1/5

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

Schema description coverage is 0%, meaning none of the 6 parameters have descriptions in the schema. The tool description provides no information about any parameters - it doesn't explain what webhookId/webhookToken are, what content format is expected, optional fields like username/avatarURL/threadId, or their purposes. The description fails to compensate for the complete lack of schema documentation.

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 target ('to a Discord channel using a webhook'), which is specific and unambiguous. It distinguishes from siblings like discord_send (which likely uses different authentication) by specifying the webhook method. However, it doesn't explicitly contrast with other messaging tools beyond the webhook aspect.

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 other messaging methods. It mentions 'using a webhook' which implies a prerequisite (having a webhook set up), but doesn't state when webhooks are preferred over other Discord API methods or what scenarios warrant this tool.

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

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

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