Skip to main content
Glama

clone_template

Create custom templates with preset values for consistent branding and design elements in RendrKit's image generation workflow.

Instructions

Clone a template with custom default values. Creates a reusable preset (e.g., your brand's product card template). Use the returned ut_ID for future generations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
template_idYesBase template ID to clone
nameYesName for your custom template
default_slotsNoDefault slot values (e.g., brand name, colors)

Implementation Reference

  • The registerCloneTemplateTool function that registers the clone_template tool with the MCP server, including its input schema (zod validation) and handler function.
    export function registerCloneTemplateTool(
      server: McpServer,
      client: RendrKitClient,
    ): void {
      server.registerTool(
        "clone_template",
        {
          description:
            "Clone a template with custom default values. Creates a reusable preset (e.g., your brand's product card template). Use the returned ut_ID for future generations.",
          inputSchema: {
            template_id: z.string().describe("Base template ID to clone"),
            name: z.string().describe("Name for your custom template"),
            default_slots: z
              .record(z.string(), z.string())
              .optional()
              .describe("Default slot values (e.g., brand name, colors)"),
          },
        },
        async ({ template_id, name, default_slots }) => {
          try {
            const result = await client.cloneTemplate({
              templateId: template_id,
              name,
              defaultSlots: default_slots,
            });
    
            return {
              content: [
                {
                  type: "text" as const,
                  text: [
                    `Template cloned!`,
                    ``,
                    `Custom ID: ut_${result.id}`,
                    `Name: ${result.name}`,
                    `Base: ${result.baseTemplateId}`,
                    ``,
                    `Use "ut_${result.id}" as template_id in generate_image to use your preset.`,
                  ].join("\n"),
                },
              ],
            };
          } catch (error) {
            return {
              content: [{ type: "text" as const, text: `Clone failed: ${error instanceof Error ? error.message : String(error)}` }],
              isError: true,
            };
          }
        },
      );
  • The async handler function that executes the clone_template tool logic. It calls client.cloneTemplate() with the provided parameters and formats the response with the custom template ID (ut_ prefix).
    async ({ template_id, name, default_slots }) => {
      try {
        const result = await client.cloneTemplate({
          templateId: template_id,
          name,
          defaultSlots: default_slots,
        });
    
        return {
          content: [
            {
              type: "text" as const,
              text: [
                `Template cloned!`,
                ``,
                `Custom ID: ut_${result.id}`,
                `Name: ${result.name}`,
                `Base: ${result.baseTemplateId}`,
                ``,
                `Use "ut_${result.id}" as template_id in generate_image to use your preset.`,
              ].join("\n"),
            },
          ],
        };
      } catch (error) {
        return {
          content: [{ type: "text" as const, text: `Clone failed: ${error instanceof Error ? error.message : String(error)}` }],
          isError: true,
        };
      }
    },
  • The cloneTemplate method in RendrKitClient that makes the actual HTTP POST request to /api/v1/templates/clone endpoint.
    async cloneTemplate(params: CloneTemplateParams): Promise<UserTemplate> {
      return this.request<UserTemplate>("POST", "/api/v1/templates/clone", {
        templateId: params.templateId,
        name: params.name,
        defaultSlots: params.defaultSlots,
      });
    }
  • Type definitions for CloneTemplateParams (input) and UserTemplate (output) interfaces used by the clone_template tool.
    export interface CloneTemplateParams {
      templateId: string;
      name: string;
      defaultSlots?: Record<string, string>;
    }
    
    /** A user-created template clone */
    export interface UserTemplate {
      id: string;
      baseTemplateId: string;
      name: string;
      defaultSlots: Record<string, string>;
      createdAt: string;
    }
  • src/server.ts:10-25 (registration)
    Import and registration of the clone_template tool in the server initialization, calling registerCloneTemplateTool.
    import { registerCloneTemplateTool } from "./tools/clone-template.js";
    
    export function createServer(client: RendrKitClient): McpServer {
      const server = new McpServer({
        name: "rendrkit",
        version: "0.3.0",
      });
    
      registerGenerateImageTool(server, client);
      registerGetImageTool(server, client);
      registerListBrandKitsTool(server, client);
      registerGetUsageTool(server, client);
      registerListTemplatesTool(server, client);
      registerUploadImageTool(server, client);
      registerBatchRenderTool(server, client);
      registerCloneTemplateTool(server, client);

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/vbiff/rendr-kit'

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