get_campaign_message
Retrieve specific campaign message details from Klaviyo using its unique ID to access content, settings, and performance data for marketing automation management.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the campaign message to retrieve |
Implementation Reference
- src/tools/campaigns.js:60-73 (handler)Handler function that fetches the campaign message from the Klaviyo API using the provided ID, includes template details, and returns JSON stringified response or error.async (params) => { try { const message = await klaviyoClient.get(`/campaign-messages/${params.id}/`, { include: "template" }); return { content: [{ type: "text", text: JSON.stringify(message, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving campaign message: ${error.message}` }], isError: true }; }
- src/tools/campaigns.js:57-59 (schema)Zod input schema defining the required 'id' parameter as a string for the campaign message ID.{ id: z.string().describe("ID of the campaign message to retrieve") },
- src/tools/campaigns.js:55-76 (registration)Registration of the 'get_campaign_message' tool on the server using server.tool, including name, schema, handler, and description.server.tool( "get_campaign_message", { id: z.string().describe("ID of the campaign message to retrieve") }, async (params) => { try { const message = await klaviyoClient.get(`/campaign-messages/${params.id}/`, { include: "template" }); return { content: [{ type: "text", text: JSON.stringify(message, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving campaign message: ${error.message}` }], isError: true }; } }, { description: "Get a specific campaign message including template details" } );
- src/server.js:37-37 (registration)Call to registerCampaignTools function which registers the 'get_campaign_message' tool (and other campaign tools) on the main MCP server.registerCampaignTools(server);