get_catalog_items
Retrieve catalog items from Klaviyo using catalog ID with optional filtering and pagination for managing product data.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| catalog_id | Yes | ID of the catalog | |
| filter | No | Filter query for catalog items | |
| page_size | No | Number of items per page (1-100) | |
| page_cursor | No | Cursor for pagination |
Implementation Reference
- src/tools/catalogs.js:37-50 (handler)Handler function that destructures catalog_id from params, calls klaviyoClient.get to fetch items from the specified catalog, stringifies the response as JSON, and handles errors.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 tool parameters: required catalog_id, optional filter, page_size, and page_cursor.{ 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)Direct registration of the get_catalog_items tool using server.tool, 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" } );
- src/server.js:41-41 (registration)Invocation of registerCatalogTools which performs the tool registrations including get_catalog_items.registerCatalogTools(server);