Skip to main content
Glama

get_metric

Retrieve specific metric data by ID using this tool on the Klaviyo MCP Server, enabling precise tracking and analysis of marketing performance metrics.

Input Schema

NameRequiredDescriptionDefault
idYesID of the metric to retrieve

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "id": { "description": "ID of the metric to retrieve", "type": "string" } }, "required": [ "id" ], "type": "object" }

Implementation Reference

  • The handler function for the 'get_metric' tool. It fetches the metric by ID using the Klaviyo client and returns the JSON response or an error message.
    async (params) => { try { const metric = await klaviyoClient.get(`/metrics/${params.id}/`); return { content: [{ type: "text", text: JSON.stringify(metric, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving metric: ${error.message}` }], isError: true }; }
  • Zod schema for input validation, requiring an 'id' string parameter.
    { id: z.string().describe("ID of the metric to retrieve") },
  • Registration of the 'get_metric' tool on the server, including schema, handler, and description.
    "get_metric", { id: z.string().describe("ID of the metric to retrieve") }, async (params) => { try { const metric = await klaviyoClient.get(`/metrics/${params.id}/`); return { content: [{ type: "text", text: JSON.stringify(metric, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving metric: ${error.message}` }], isError: true }; } }, { description: "Get a specific metric from Klaviyo" } );

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