get_catalog_items
Retrieve catalog items from the Klaviyo MCP Server using a catalog ID, filter query, pagination cursor, and page size. Efficiently manage and access product data for marketing automation.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| catalog_id | Yes | ID of the catalog | |
| filter | No | Filter query for catalog items | |
| page_cursor | No | Cursor for pagination | |
| page_size | No | Number of items per page (1-100) |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"catalog_id": {
"description": "ID of the catalog",
"type": "string"
},
"filter": {
"description": "Filter query for catalog items",
"type": "string"
},
"page_cursor": {
"description": "Cursor for pagination",
"type": "string"
},
"page_size": {
"description": "Number of items per page (1-100)",
"maximum": 100,
"minimum": 1,
"type": "number"
}
},
"required": [
"catalog_id"
],
"type": "object"
}
Implementation Reference
- src/tools/catalogs.js:37-50 (handler)Handler function for the get_catalog_items tool. It extracts catalog_id, calls klaviyoClient.get to fetch items with query params, and returns JSON stringified response or error.async (params) => { try { const { catalog_id, ...queryParams } = params; const items = await klaviyoClient.get(`/catalogs/${catalog_id}/items/`, queryParams); return { content: [{ type: "text", text: JSON.stringify(items, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving catalog items: ${error.message}` }], isError: true }; } },
- src/tools/catalogs.js:31-36 (schema)Input schema using Zod for validating parameters: catalog_id (required string), filter (optional string), page_size (optional number 1-100), page_cursor (optional string).{ catalog_id: z.string().describe("ID of the catalog"), filter: z.string().optional().describe("Filter query for catalog items"), page_size: z.number().min(1).max(100).optional().describe("Number of items per page (1-100)"), page_cursor: z.string().optional().describe("Cursor for pagination") },
- src/tools/catalogs.js:29-52 (registration)Registration of the get_catalog_items tool on the MCP server, including name, input schema, handler function, and description.server.tool( "get_catalog_items", { catalog_id: z.string().describe("ID of the catalog"), filter: z.string().optional().describe("Filter query for catalog items"), page_size: z.number().min(1).max(100).optional().describe("Number of items per page (1-100)"), page_cursor: z.string().optional().describe("Cursor for pagination") }, async (params) => { try { const { catalog_id, ...queryParams } = params; const items = await klaviyoClient.get(`/catalogs/${catalog_id}/items/`, queryParams); return { content: [{ type: "text", text: JSON.stringify(items, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving catalog items: ${error.message}` }], isError: true }; } }, { description: "Get items from a catalog in Klaviyo" } );