Skip to main content
Glama

create_template

Generate customizable product templates for e-commerce platforms by defining dimensions, layers, and shop domain using the TailorKit MCP server.

Instructions

Create a new template with shop domain

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
_idNoThe id of the template
dimensionNoThe dimension of the template
layersNoThe layers of the template
nameYesThe name of the templateNew Template
shopDomainYesThe shop domain ends with .myshopify.com

Implementation Reference

  • The main handler function for the 'create_template' MCP tool. It uses a factory to combine argument validation and the service method that calls templateService.createTemplate(args). Includes validator (lines 8-18) and service method (23-28).
    export const createTemplateHandler = createHandler<CreateTemplateArgs, any>( validateCreateTemplateArgs, createTemplateServiceMethod );
  • Definition of the 'create_template' tool including name, description, and detailed JSON inputSchema for parameters like _id, shopDomain, name, dimension, layers.
    const createTemplateTool: TailorKitTool = { name: TAILOR_KIT_TOOL_NAMES.CREATE_TEMPLATE, description: "Create a new template with shop domain", inputSchema: { type: "object", properties: { _id: { type: "string", description: "The id of the template", pattern: UUID_PATTERN, }, shopDomain: { type: "string", description: "The shop domain ends with .myshopify.com", }, name: { type: "string", description: "The name of the template", default: "New Template", }, dimension: { type: "object", description: "The dimension of the template", properties: { width: { type: "number", description: "The width of the template", default: 1000, }, height: { type: "number", description: "The height of the template", default: 1000, }, measurementUnit: { type: "string", description: "The measurement unit", default: "px", }, resolution: { type: "number", description: "The resolution of the template", default: 300, }, }, required: ["width", "height", "measurementUnit", "resolution"], }, layers: { type: "array", description: "The layers of the template", items: { type: "object", properties: { _id: { type: "string", description: "The id of the layer", pattern: UUID_PATTERN, }, label: { type: "string", description: "The label of the layer", }, type: { type: "string", description: "The type of the layer", enum: ["group", "text", "image", "imageless", "multi-layout"], }, locked: { type: "boolean", description: "Whether the layer is locked", default: false, }, visible: { type: "boolean", description: "Whether the layer is visible", default: true, }, left: { type: "number", description: "The left position of the layer", default: 0, }, top: { type: "number", description: "The top position of the layer", default: 0, }, rotate: { type: "number", description: "The rotation of the layer", default: 0, }, width: { type: "number", description: "The width of the layer", default: 0, }, height: { type: "number", description: "The height of the layer", default: 0, }, image: { type: "object", description: "The image of the layer. Only used for image layer", properties: { src: { type: "string", description: "The source of the image", }, width: { type: "number", description: "The width of the image", default: 0, }, height: { type: "number", description: "The height of the image", default: 0, }, }, }, children: { type: "array", description: "The children of the layer", items: { type: "string", }, }, settings: { type: "object", description: "The settings of the layer", properties: {}, }, }, required: [ "_id", "label", "type", "locked", "visible", "left", "top", "rotate", "width", "height", ], }, }, ...COMMON_TOOL_PROPERTIES, }, required: ["_id","shopDomain", "name", "dimension", "prompt", "conversationId", "conversationTitle"], }, }; export default createTemplateTool;
  • Registration of the create_template tool handler in the TemplateHandlerRegistrar class.
    this.registry.register( TAILOR_KIT_TOOL_NAMES.CREATE_TEMPLATE, (args: unknown) => createTemplateHandler(this.serviceManager, args) );
  • TypeScript interface defining the input arguments for the create_template tool.
    export interface CreateTemplateArgs extends CommonToolArgs { /** * The id of the template */ _id?: string; /** * The name of the template */ name: string; /** * The dimension of the template */ dimension: { width: number; height: number; measurementUnit: "px" | "cm" | "inch" | "mm"; resolution: number; }; /** * The layers of the template */ layers?: Array<{ _id: string; label: string; type: 'group' | 'text' | 'image' | 'imageless' | 'multi-layout'; locked: boolean; visible: boolean; left: number; top: number; rotate: number; width: number; height: number; children?: string[]; image?: { src: string; width: number; height: number; }; settings?: Record<string, any>; }>; }
  • Import and inclusion of the createTemplateTool in the main tools export array.
    import createTemplateTool from "./template/createTemplateTool.js"; import getDetailTemplateTool from "./template/getDetailTemplateTool.js"; import getListLayersOfTemplateTool from "./layer/getListLayersOfTemplateTool.js"; import getListTemplatesTool from "./template/getListTemplatesTool.js"; import getDetailProductTool from "./shopify/products/getDetailProductTool.js"; import { getListProductsTool } from "./shopify/products/index.js"; import getUserPreferencesTool from "./userPreferences/getUserPreferencesTool.js"; const TOOLS = [ getListTemplatesTool, getDetailTemplateTool, createTemplateTool,

Other Tools

Related Tools

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/sellersmith/tailorkit-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server