Skip to main content
Glama

get_images

Retrieve images from Klaviyo's media library using filters and pagination for marketing content management.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filterNoFilter query for images
page_sizeNoNumber of images per page (1-100)
page_cursorNoCursor for pagination

Implementation Reference

  • 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
        };
      }
    },
  • 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")
    },
  • 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';

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ivan-rivera-projects/Klaviyo-MCP-Server-Enhanced'

If you have feedback or need assistance with the MCP directory API, please join our Discord server