discord_edit_webhook
Modify an existing Discord webhook to update its name, avatar, or channel ID. Use this tool to manage webhook configurations within the MCP-Discord server for efficient integration and communication.
Instructions
Edits an existing webhook for a Discord channel
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| avatar | No | ||
| channelId | No | ||
| name | No | ||
| reason | No | ||
| webhookId | Yes | ||
| webhookToken | No |
Implementation Reference
- src/index.ts:1307-1345 (handler)Handler function that executes the discord_edit_webhook tool. Fetches the webhook using client.fetchWebhook, parses arguments with EditWebhookSchema, edits the webhook using webhook.edit, handles errors and client readiness.case "discord_edit_webhook": { const { webhookId, webhookToken, name, avatar, channelId, reason } = EditWebhookSchema.parse(args); try { if (!client.isReady()) { return { content: [{ type: "text", text: "Discord client not logged in. Please use discord_login tool first." }], isError: true }; } const webhook = await 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: name, avatar: avatar, channel: channelId, reason: reason }); return { content: [{ type: "text", text: `Successfully edited webhook with ID: ${webhook.id}` }] }; } catch (error) { return { content: [{ type: "text", text: `Failed to edit webhook: ${error}` }], isError: true }; } }
- src/index.ts:137-144 (schema)Zod schema for input validation of discord_edit_webhook tool parameters: webhookId (required), optional webhookToken, name, avatar, channelId, reason.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/index.ts:429-443 (registration)Tool registration in the ListToolsRequestHandler response, defining name, description, and inputSchema for discord_edit_webhook.{ 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"] }