Skip to main content
Glama

discord_edit_webhook

Modify an existing Discord webhook's name, avatar, or channel to update automated message delivery settings.

Instructions

Edits an existing webhook for a Discord channel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
webhookIdYes
webhookTokenNo
nameNo
avatarNo
channelIdNo
reasonNo

Implementation Reference

  • The main handler function for 'discord_edit_webhook' tool. It validates input using EditWebhookSchema, fetches the webhook using Discord client, edits it with provided parameters, and returns success or error response.
    export async function editWebhookHandler(
      args: unknown,
      context: ToolContext
    ): Promise<ToolResponse> {
      const { webhookId, webhookToken, name, avatar, channelId, reason } =
        EditWebhookSchema.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,
          };
        }
    
        // Edit the webhook
        await webhook.edit({
          name,
          avatar,
          channel: channelId,
          reason,
        });
    
        return {
          content: [
            {
              type: 'text',
              text: `Successfully edited webhook with ID: ${webhook.id}`,
            },
          ],
        };
      } catch (error) {
        return handleDiscordError(error);
      }
    }
  • Zod schema defining the input parameters and validation for the discord_edit_webhook tool.
    export const EditWebhookSchema = z.object({
      webhookId: z.string(),
      webhookToken: z.string().optional(),
      name: z.string().optional(),
      avatar: z.string().optional(),
      channelId: z.string().optional(),
      reason: z.string().optional(),
    });
  • Registration entry for the tool including name, description, and JSON schema compatible input schema, likely used in MCP tools/list response.
    {
      name: 'discord_edit_webhook',
      description: 'Edits an existing webhook for a Discord channel',
      inputSchema: {
        type: 'object',
        properties: {
          webhookId: { type: 'string' },
          webhookToken: { type: 'string' },
          name: { type: 'string' },
          avatar: { type: 'string' },
          channelId: { type: 'string' },
          reason: { type: 'string' },
        },
        required: ['webhookId'],
      },
    },
  • src/server.ts:199-202 (registration)
    Dispatch/registration case in server.ts that calls the editWebhookHandler upon tool invocation.
    case 'discord_edit_webhook':
      this.logClientState('before discord_edit_webhook handler');
      toolResponse = await editWebhookHandler(args, this.toolContext);
      return toolResponse;
  • Dispatch case in transport.ts HTTP handler that routes 'discord_edit_webhook' to editWebhookHandler.
    case 'discord_edit_webhook':
      result = await editWebhookHandler(params, this.toolContext!);
      break;

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