Skip to main content
Glama

get_segment

Retrieve specific customer segments by ID from the Klaviyo API using the MCP server to manage marketing automation and customer profiling effectively.

Input Schema

NameRequiredDescriptionDefault
idYesID of the segment to retrieve

Input Schema (JSON Schema)

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

Implementation Reference

  • Handler function for the 'get_segment' tool. Fetches a specific segment from Klaviyo API using the provided ID and returns JSON stringified response or error.
    async (params) => { try { const segment = await klaviyoClient.get(`/segments/${params.id}/`); return { content: [{ type: "text", text: JSON.stringify(segment, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving segment: ${error.message}` }], isError: true }; }
  • Zod input schema for 'get_segment' tool, requiring a string 'id' parameter.
    { id: z.string().describe("ID of the segment to retrieve") },
  • Registration of the 'get_segment' tool on the MCP server, including name, schema, handler, and description.
    "get_segment", { id: z.string().describe("ID of the segment to retrieve") }, async (params) => { try { const segment = await klaviyoClient.get(`/segments/${params.id}/`); return { content: [{ type: "text", text: JSON.stringify(segment, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving segment: ${error.message}` }], isError: true }; } }, { description: "Get a specific segment 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