Skip to main content
Glama

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
NameRequiredDescriptionDefault
idYesID of the campaign to retrieve

Implementation Reference

  • 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
        };
      }
    },
  • Zod schema defining the input parameter 'id' for the campaign ID.
    {
      id: z.string().describe("ID of the campaign to retrieve")
    },
  • 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);

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