get_image
Retrieve specific images by their unique ID using the Klaviyo MCP Server tool, designed for managing marketing automation resources efficiently.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the image to retrieve |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"id": {
"description": "ID of the image to retrieve",
"type": "string"
}
},
"required": [
"id"
],
"type": "object"
}
Implementation Reference
- src/tools/images.js:35-47 (handler)Handler function that fetches a specific image from the Klaviyo API using the provided image ID and returns it as JSON or an error message.async (params) => { try { const image = await klaviyoClient.get(`/images/${params.id}/`); return { content: [{ type: "text", text: JSON.stringify(image, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving image: ${error.message}` }], isError: true }; } },
- src/tools/images.js:32-34 (schema)Zod schema defining the input parameter 'id' for the get_image tool.{ id: z.string().describe("ID of the image to retrieve") },
- src/tools/images.js:30-49 (registration)Direct registration of the 'get_image' tool on the MCP server, including schema, handler, and description.server.tool( "get_image", { id: z.string().describe("ID of the image to retrieve") }, async (params) => { try { const image = await klaviyoClient.get(`/images/${params.id}/`); return { content: [{ type: "text", text: JSON.stringify(image, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving image: ${error.message}` }], isError: true }; } }, { description: "Get a specific image from Klaviyo" } );
- src/server.js:48-48 (registration)Top-level call to registerImageTools during server setup, which includes registration of get_image.registerImageTools(server);