get_webhooks
Retrieve webhooks from the Klaviyo MCP Server with configurable pagination, specifying page size and cursor for efficient data handling and integration.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page_cursor | No | Cursor for pagination | |
| page_size | No | Number of webhooks per page (1-100) |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"page_cursor": {
"description": "Cursor for pagination",
"type": "string"
},
"page_size": {
"description": "Number of webhooks per page (1-100)",
"maximum": 100,
"minimum": 1,
"type": "number"
}
},
"type": "object"
}
Implementation Reference
- src/tools/webhooks.js:7-26 (registration)Primary registration of the 'get_webhooks' tool using server.tool(), including inline schema, handler, and description."get_webhooks", { page_size: z.number().min(1).max(100).optional().describe("Number of webhooks per page (1-100)"), page_cursor: z.string().optional().describe("Cursor for pagination") }, async (params) => { try { const webhooks = await klaviyoClient.get('/webhooks/', params); return { content: [{ type: "text", text: JSON.stringify(webhooks, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving webhooks: ${error.message}` }], isError: true }; } }, { description: "Get webhooks from Klaviyo" } );
- src/tools/webhooks.js:12-24 (handler)The handler function that executes the tool logic: fetches webhooks from Klaviyo API using klaviyoClient.get and formats the response.async (params) => { try { const webhooks = await klaviyoClient.get('/webhooks/', params); return { content: [{ type: "text", text: JSON.stringify(webhooks, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving webhooks: ${error.message}` }], isError: true }; } },
- src/tools/webhooks.js:9-11 (schema)Input schema using Zod for pagination parameters: page_size (optional, 1-100) and page_cursor (optional).page_size: z.number().min(1).max(100).optional().describe("Number of webhooks per page (1-100)"), page_cursor: z.string().optional().describe("Cursor for pagination") },
- src/server.js:43-43 (registration)High-level registration call that invokes registerWebhookTools to add webhook tools, including get_webhooks, to the MCP server.registerWebhookTools(server);
- src/server.js:14-14 (registration)Import of the registerWebhookTools function used to register webhook tools.import { registerWebhookTools } from './tools/webhooks.js';