Skip to main content
Glama

create_tag

Generate and manage tags in Klaviyo to organize customer profiles, campaigns, and marketing workflows. Supports system and custom tag types for efficient categorization.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the tag
tag_typeYesType of tag

Implementation Reference

  • Handler function that constructs the payload for creating a tag and calls klaviyoClient.post to the '/tags/' endpoint. Handles errors by returning error content.
    async (params) => { try { const payload = { data: { type: "tag", attributes: { name: params.name, tag_type: params.tag_type } } }; const result = await klaviyoClient.post('/tags/', payload); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error creating tag: ${error.message}` }], isError: true }; }
  • Zod validation schema for the create_tag tool inputs: name (string) and tag_type (enum: system or custom).
    { name: z.string().describe("Name of the tag"), tag_type: z.enum(["system", "custom"]).describe("Type of tag") },
  • Direct registration of the 'create_tag' tool using server.tool(), including name, schema, handler function, and description.
    "create_tag", { name: z.string().describe("Name of the tag"), tag_type: z.enum(["system", "custom"]).describe("Type of tag") }, async (params) => { try { const payload = { data: { type: "tag", attributes: { name: params.name, tag_type: params.tag_type } } }; const result = await klaviyoClient.post('/tags/', payload); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error creating tag: ${error.message}` }], isError: true }; } }, { description: "Create a new tag in Klaviyo" } );
  • src/server.js:42-42 (registration)
    Top-level call to registerTagTools which includes the create_tag tool registration.
    registerTagTools(server);
  • The post function from klaviyoClient used by the handler to make the API POST request to create the tag.
    export async function post(endpoint, data, fallbackFn) { return executeWithRetry( () => client.post(endpoint, data), 'POST', endpoint, data, fallbackFn ); }

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