discord_delete_webhook
Delete a specific Discord webhook using its ID and token to manage channel integrations effectively. Supports providing a reason for deletion.
Instructions
Deletes an existing webhook for a Discord channel
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| reason | No | ||
| webhookId | Yes | ||
| webhookToken | No |
Implementation Reference
- src/index.ts:445-457 (registration)Registration of the 'discord_delete_webhook' tool in the MCP server's tool list, including name, description, and input schema.{ name: "discord_delete_webhook", description: "Deletes an existing webhook for a Discord channel", inputSchema: { type: "object", properties: { webhookId: { type: "string" }, webhookToken: { type: "string" }, reason: { type: "string" } }, required: ["webhookId"] } }
- src/index.ts:146-150 (schema)Zod schema definition for input parameters validation of the 'discord_delete_webhook' tool.const DeleteWebhookSchema = z.object({ webhookId: z.string(), webhookToken: z.string().optional(), reason: z.string().optional() });
- src/index.ts:1347-1380 (handler)Handler function for 'discord_delete_webhook' tool that parses arguments, checks client readiness, fetches the webhook using Discord.js, and deletes it.case "discord_delete_webhook": { const { webhookId, webhookToken, reason } = DeleteWebhookSchema.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 }; } // Delete the webhook await webhook.delete(reason || "Webhook deleted via API"); return { content: [{ type: "text", text: `Successfully deleted webhook with ID: ${webhook.id}` }] }; } catch (error) { return { content: [{ type: "text", text: `Failed to delete webhook: ${error}` }], isError: true }; } }