delete_webhook
Remove a Discord webhook by ID to stop automated messages or integrations, optionally specifying a reason for deletion.
Instructions
Delete a webhook
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| webhookId | Yes | The ID of the webhook | |
| reason | No | Reason for deleting |
Implementation Reference
- src/tools/webhook-tools.ts:144-160 (handler)The main execution logic for the delete_webhook tool: fetches the webhook using Discord client, deletes it with optional reason, handles errors, and formats response.async ({ webhookId, reason }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const webhook = await client.fetchWebhook(webhookId); const webhookName = webhook.name; await webhook.delete(reason); return { webhookId, webhookName, message: 'Webhook deleted successfully' }; }); if (!result.success) { return { content: [{ type: 'text', text: result.error }], isError: true }; } return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] }; }
- src/tools/webhook-tools.ts:140-143 (schema)Input schema using Zod: requires webhookId string, optional reason string.{ webhookId: z.string().describe('The ID of the webhook'), reason: z.string().optional().describe('Reason for deleting'), },
- src/tools/webhook-tools.ts:137-161 (registration)Registers the delete_webhook tool on the MCP server instance with name, description, input schema, and handler function.server.tool( 'delete_webhook', 'Delete a webhook', { webhookId: z.string().describe('The ID of the webhook'), reason: z.string().optional().describe('Reason for deleting'), }, async ({ webhookId, reason }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const webhook = await client.fetchWebhook(webhookId); const webhookName = webhook.name; await webhook.delete(reason); return { webhookId, webhookName, message: 'Webhook deleted successfully' }; }); if (!result.success) { return { content: [{ type: 'text', text: result.error }], isError: true }; } return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] }; } );
- src/index.ts:60-60 (registration)Top-level registration call that invokes registerWebhookTools to add all webhook tools, including delete_webhook, to the MCP server.registerWebhookTools(server);