get_images
Retrieve images from Klaviyo's media library using filters and pagination for marketing content management.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filter | No | Filter query for images | |
| page_size | No | Number of images per page (1-100) | |
| page_cursor | No | Cursor for pagination |
Implementation Reference
- src/tools/images.js:13-25 (handler)The handler function for the 'get_images' tool. It calls klaviyoClient.get('/images/', params) to fetch images from the Klaviyo API, stringifies the response as JSON text content, or returns an error message if the request fails.async (params) => { try { const images = await klaviyoClient.get('/images/', params); return { content: [{ type: "text", text: JSON.stringify(images, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving images: ${error.message}` }], isError: true }; } },
- src/tools/images.js:8-12 (schema)Input schema for the 'get_images' tool using Zod: optional filter (string), page_size (number 1-100), page_cursor (string).{ filter: z.string().optional().describe("Filter query for images"), page_size: z.number().min(1).max(100).optional().describe("Number of images per page (1-100)"), page_cursor: z.string().optional().describe("Cursor for pagination") },
- src/tools/images.js:6-27 (registration)Registration of the 'get_images' tool via server.tool call, including the tool name, input schema, handler function, and description.server.tool( "get_images", { filter: z.string().optional().describe("Filter query for images"), page_size: z.number().min(1).max(100).optional().describe("Number of images per page (1-100)"), page_cursor: z.string().optional().describe("Cursor for pagination") }, async (params) => { try { const images = await klaviyoClient.get('/images/', params); return { content: [{ type: "text", text: JSON.stringify(images, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving images: ${error.message}` }], isError: true }; } }, { description: "Get images from Klaviyo" } );
- src/server.js:48-48 (registration)Invocation of registerImageTools(server) which registers the image tools, including 'get_images'.registerImageTools(server);
- src/server.js:19-19 (registration)Import of registerImageTools from images.js used to register image tools.import { registerImageTools } from './tools/images.js';