discord_edit_webhook
Edit a Discord webhook by changing its name, avatar, or channel assignment. Requires webhook ID and optional token for authentication.
Instructions
Edits an existing webhook for a Discord channel
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| webhookId | Yes | ||
| webhookToken | No | ||
| name | No | ||
| avatar | No | ||
| channelId | No | ||
| reason | No |
Implementation Reference
- src/tools/webhooks.ts:116-160 (handler)The main handler function for 'discord_edit_webhook'. It fetches the webhook by ID (and optional token), then calls webhook.edit() with optional name, avatar, channelId, and reason. Returns a success or error response.
// Edit webhook handler 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 (EditWebhookSchema) defining validation for the edit webhook input: webhookId (required), webhookToken, name, avatar, channelId, and reason (all optional).
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 of 'discord_edit_webhook' in the tool list with its description and input schema. Required field is only webhookId.
{ 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)Server-side dispatch: routes the 'discord_edit_webhook' tool call to editWebhookHandler.
case 'discord_edit_webhook': this.logClientState('before discord_edit_webhook handler'); toolResponse = await editWebhookHandler(args, this.toolContext); return toolResponse; - src/transport.ts:592-594 (helper)Transport-level dispatch in the StreamableHttpTransport: routes the 'discord_edit_webhook' tool call to editWebhookHandler.
case 'discord_edit_webhook': result = await editWebhookHandler(toolArgs, this.toolContext!); break;