delete_webhook
Remove a specified webhook from the Klaviyo MCP Server by providing its unique ID, ensuring efficient management of webhook integrations and configurations.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the webhook to delete |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"id": {
"description": "ID of the webhook to delete",
"type": "string"
}
},
"required": [
"id"
],
"type": "object"
}
Implementation Reference
- src/tools/webhooks.js:79-91 (handler)The handler function for the 'delete_webhook' tool. It takes the webhook ID from params and calls the Klaviyo client's delete method on the webhooks endpoint.async (params) => { try { await klaviyoClient.del(`/webhooks/${params.id}/`); return { content: [{ type: "text", text: "Webhook deleted successfully" }] }; } catch (error) { return { content: [{ type: "text", text: `Error deleting webhook: ${error.message}` }], isError: true }; } },
- src/tools/webhooks.js:76-78 (schema)Zod input schema for the 'delete_webhook' tool, requiring a string 'id' parameter.{ id: z.string().describe("ID of the webhook to delete") },
- src/tools/webhooks.js:74-93 (registration)Registration of the 'delete_webhook' tool using server.tool(), including name, schema, handler, and description.server.tool( "delete_webhook", { id: z.string().describe("ID of the webhook to delete") }, async (params) => { try { await klaviyoClient.del(`/webhooks/${params.id}/`); return { content: [{ type: "text", text: "Webhook deleted successfully" }] }; } catch (error) { return { content: [{ type: "text", text: `Error deleting webhook: ${error.message}` }], isError: true }; } }, { description: "Delete a webhook from Klaviyo" } );
- src/server.js:43-43 (registration)Invocation of registerWebhookTools which registers the delete_webhook tool among others.registerWebhookTools(server);
- src/klaviyo-client.js:202-219 (helper)The generic del function from the Klaviyo client used in the tool handler to perform the HTTP DELETE request.export async function del(endpoint, data, fallbackFn) { return executeWithRetry( () => { const config = data ? { data } : undefined; return client.delete(endpoint, config); }, 'DELETE', endpoint, data, fallbackFn ).then(response => { // For DELETE requests that return 204 No Content if (response === undefined) { return { success: true }; } return response; }); }