discord_delete_webhook
Delete a webhook from a Discord channel by providing its ID and token. Optionally include a reason for the deletion.
Instructions
Deletes an existing webhook for a Discord channel
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| webhookId | Yes | ||
| webhookToken | No | ||
| reason | No |
Implementation Reference
- src/tools/webhooks.ts:163-200 (handler)Main handler function that deletes a Discord webhook by fetching it via webhookId/webhookToken and calling webhook.delete().
export async function deleteWebhookHandler( args: unknown, context: ToolContext ): Promise<ToolResponse> { const { webhookId, webhookToken, reason } = DeleteWebhookSchema.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, }; } // 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 handleDiscordError(error); } }