Skip to main content
Glama

create_list

Generate and manage customer lists or segments within the Klaviyo API by specifying a name and type. Use this tool to organize and segment audience data for targeted marketing campaigns.

Input Schema

NameRequiredDescriptionDefault
list_typeYesType of list (list or segment)
nameYesName of the list

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "list_type": { "description": "Type of list (list or segment)", "enum": [ "list", "segment" ], "type": "string" }, "name": { "description": "Name of the list", "type": "string" } }, "required": [ "name", "list_type" ], "type": "object" }

Implementation Reference

  • The handler function for the 'create_list' tool. It constructs a payload with the list name and type, then calls klaviyoClient.post to create the list via Klaviyo API, returning the result or error.
    async (params) => { try { const payload = { data: { type: "list", attributes: { name: params.name, list_type: params.list_type } } }; const result = await klaviyoClient.post('/lists/', payload); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error creating list: ${error.message}` }], isError: true }; } },
  • Zod schema defining the input parameters for the create_list tool: name (string) and list_type (enum: list or segment).
    { name: z.string().describe("Name of the list"), list_type: z.enum(["list", "segment"]).describe("Type of list (list or segment)") },
  • Direct registration of the 'create_list' tool using server.tool, including schema, inline handler, and description.
    server.tool( "create_list", { name: z.string().describe("Name of the list"), list_type: z.enum(["list", "segment"]).describe("Type of list (list or segment)") }, async (params) => { try { const payload = { data: { type: "list", attributes: { name: params.name, list_type: params.list_type } } }; const result = await klaviyoClient.post('/lists/', payload); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error creating list: ${error.message}` }], isError: true }; } }, { description: "Create a new list in Klaviyo" } );
  • src/server.js:33-33 (registration)
    Top-level call to registerListTools(server), which in turn registers the create_list tool among others.
    registerListTools(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