Skip to main content
Glama

get_template

Retrieve a specific template by its ID using the Klaviyo MCP Server. This tool simplifies accessing and managing email templates for marketing automation workflows.

Input Schema

NameRequiredDescriptionDefault
idYesID of the template to retrieve

Input Schema (JSON Schema)

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

Implementation Reference

  • The async handler function that fetches the specific template by ID from the Klaviyo API using klaviyoClient.get, formats it as JSON, and handles errors.
    async (params) => { try { const template = await klaviyoClient.get(`/templates/${params.id}/`); return { content: [{ type: "text", text: JSON.stringify(template, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving template: ${error.message}` }], isError: true }; } },
  • Zod input schema defining the required 'id' parameter as a string.
    { id: z.string().describe("ID of the template to retrieve") },
  • The server.tool call that registers the 'get_template' tool, including name, schema, handler, and description.
    "get_template", { id: z.string().describe("ID of the template to retrieve") }, async (params) => { try { const template = await klaviyoClient.get(`/templates/${params.id}/`); return { content: [{ type: "text", text: JSON.stringify(template, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving template: ${error.message}` }], isError: true }; } }, { description: "Get a specific template from Klaviyo" } );
  • src/server.js:40-40 (registration)
    The call to registerTemplateTools which includes registration of the 'get_template' tool.
    registerTemplateTools(server);
  • src/server.js:11-11 (registration)
    Import of the registerTemplateTools function from templates.js.
    import { registerTemplateTools } from './tools/templates.js';

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