get_campaign
Retrieve detailed campaign information from Klaviyo using a specific campaign ID to access marketing performance data and configuration details.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the campaign to retrieve |
Implementation Reference
- src/tools/campaigns.js:38-50 (handler)Executes the tool logic by fetching the specific campaign from Klaviyo API using the provided ID and formatting the response.async (params) => { try { const campaign = await klaviyoClient.get(`/campaigns/${params.id}/`); return { content: [{ type: "text", text: JSON.stringify(campaign, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving campaign: ${error.message}` }], isError: true }; } },
- src/tools/campaigns.js:35-37 (schema)Zod schema defining the input parameter 'id' for the campaign ID.{ id: z.string().describe("ID of the campaign to retrieve") },
- src/tools/campaigns.js:34-52 (registration)Registers the 'get_campaign' tool with the MCP server, including schema, handler, and description."get_campaign", { id: z.string().describe("ID of the campaign to retrieve") }, async (params) => { try { const campaign = await klaviyoClient.get(`/campaigns/${params.id}/`); return { content: [{ type: "text", text: JSON.stringify(campaign, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving campaign: ${error.message}` }], isError: true }; } }, { description: "Get a specific campaign from Klaviyo" } );
- src/server.js:37-37 (registration)Calls the registerCampaignTools function to register the get_campaign tool among others.registerCampaignTools(server);