get_campaign_message
Retrieve specific campaign message details by providing the campaign ID using this tool on the Klaviyo MCP Server, enabling efficient management of marketing automation workflows.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the campaign message to retrieve |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"id": {
"description": "ID of the campaign message to retrieve",
"type": "string"
}
},
"required": [
"id"
],
"type": "object"
}
Implementation Reference
- src/tools/campaigns.js:60-74 (handler)Handler function that fetches the specific campaign message by ID from Klaviyo API, including template details, and returns formatted JSON 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 with description.{ id: z.string().describe("ID of the campaign message to retrieve") },
- src/tools/campaigns.js:55-76 (registration)Full server.tool registration of the 'get_campaign_message' 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)High-level registration invocation that calls registerCampaignTools(server), which in turn registers the get_campaign_message tool.registerCampaignTools(server);