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
| Name | Required | Description | Default |
|---|---|---|---|
| webhookId | Yes | ||
| webhookToken | No | ||
| name | No | ||
| avatar | No | ||
| channelId | No | ||
| reason | No |
Implementation Reference
- src/tools/webhooks.ts:117-160 (handler)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); } }
- src/schemas.ts:119-126 (schema)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(), });
- src/tool-list.ts:272-287 (registration)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;
- src/transport.ts:376-378 (registration)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;