delete_webhook
Remove a Discord webhook by its ID to stop automated messages or manage integrations. Specify a reason for deletion when needed.
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 handler function for the delete_webhook tool. It fetches the webhook using the Discord client and deletes it, handling errors with withErrorHandling and returning formatted success/error responses.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)Zod schema defining the input parameters for the delete_webhook tool: required webhookId and optional reason.{ 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)Registration of the delete_webhook tool using server.tool(), including name, description, input schema, and handler function within the registerWebhookTools 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) }] }; } );