Skip to main content
Glama

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
NameRequiredDescriptionDefault
webhookIdYesThe ID of the webhook
reasonNoReason for deleting

Implementation Reference

  • 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) }] }; }
  • 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'), },
  • 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) }] }; } );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/scarecr0w12/discord-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server