Skip to main content
Glama

batch_render

Generate multiple images from one template with different data, suitable for e-commerce catalogs, certificates, and social media series. Supports up to 20 items per batch.

Instructions

Generate multiple images from the same template with different data. Perfect for e-commerce catalogs, certificates, social media series. Up to 20 items per batch.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
template_idYesTemplate ID to use for all items
itemsYesArray of items to render (max 20)

Implementation Reference

  • The registerBatchRenderTool function registers the 'batch_render' tool on the MCP server. The handler (line 28-64) validates input with Zod, maps snake_case params to camelCase, calls client.batchRender(), and formats the response as a text block listing generated image URLs and any errors.
    export function registerBatchRenderTool(
      server: McpServer,
      client: RendrKitClient,
    ): void {
      server.registerTool(
        "batch_render",
        {
          description:
            "Generate multiple images from the same template with different data. Perfect for e-commerce catalogs, certificates, social media series. Up to 20 items per batch.",
          inputSchema: {
            template_id: z
              .string()
              .describe("Template ID to use for all items"),
            items: z
              .array(
                z.object({
                  slots: z.record(z.string(), z.string()).describe("Slot values for this item"),
                  image_url: z.string().optional().describe("Photo URL for this item"),
                }),
              )
              .describe("Array of items to render (max 20)"),
          },
        },
        async ({ template_id, items }) => {
          try {
            const result = await client.batchRender({
              templateId: template_id,
              items: items.map((item) => ({
                slots: item.slots,
                imageUrl: item.image_url,
              })),
            });
    
            const lines = result.images.map(
              (img, i) => `${i + 1}. ${img.url}`,
            );
            const errorLines = result.errors?.map(
              (e) => `Error at index ${e.index}: ${e.message}`,
            ) ?? [];
    
            return {
              content: [
                {
                  type: "text" as const,
                  text: [
                    `Batch complete: ${result.images.length} images generated`,
                    ``,
                    ...lines,
                    ...(errorLines.length > 0 ? [``, `Errors:`, ...errorLines] : []),
                  ].join("\n"),
                },
              ],
            };
          } catch (error) {
            return {
              content: [{ type: "text" as const, text: `Batch render failed: ${error instanceof Error ? error.message : String(error)}` }],
              isError: true,
            };
          }
        },
      );
    }
  • BatchRenderParams interface defines the input shape (templateId + items array with slots and optional imageUrl). BatchRenderResponse defines the output shape (images array of GeneratedImage + optional errors array).
    /** Parameters for batch render */
    export interface BatchRenderParams {
      templateId: string;
      items: Array<{
        slots: Record<string, string>;
        imageUrl?: string;
      }>;
    }
    
    /** Response from batch render */
    export interface BatchRenderResponse {
      images: GeneratedImage[];
      errors?: Array<{ index: number; code: string; message: string }>;
    }
  • src/server.ts:9-28 (registration)
    The tool is imported from './tools/batch-render.js' and registered at line 24 via registerBatchRenderTool(server, client).
    import { registerBatchRenderTool } from "./tools/batch-render.js";
    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);
    
      return server;
    }
  • The batchRender method on RendrKitClient sends a POST request to '/api/v1/generate/batch-render' with BatchRenderParams, returning a Promise<BatchRenderResponse>.
    async batchRender(params: BatchRenderParams): Promise<BatchRenderResponse> {
      return this.request<BatchRenderResponse>("POST", "/api/v1/generate/batch-render", params);
    }
  • Zod input schema for the tool: template_id (string) and items (array of objects with 'slots' record and optional 'image_url').
    inputSchema: {
      template_id: z
        .string()
        .describe("Template ID to use for all items"),
      items: z
        .array(
          z.object({
            slots: z.record(z.string(), z.string()).describe("Slot values for this item"),
            image_url: z.string().optional().describe("Photo URL for this item"),
          }),
        )
        .describe("Array of items to render (max 20)"),
    },
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It reveals the batch size limit but does not disclose permissions, rate limits, return format, or error handling. Some key behavioral traits are missing.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Extremely concise with two sentences. The first sentence states the core action, and the second adds context and usage. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no output schema and two parameters, the description covers purpose, use cases, and a key constraint (batch limit). It lacks details on output format and error behavior, but is sufficient for basic understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the description adds little extra meaning beyond what is in the schema. It mentions 'different data' but does not provide additional details about parameter usage or constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it generates multiple images from a template with different data, using specific verbs and resources. It distinguishes from sibling tools like generate_image (single image) and clone_template (template duplication).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit use cases (e-commerce catalogs, certificates, social media series) and a batch limit of 20 items. However, it does not explicitly mention when not to use or alternatives, though these can be inferred from sibling names.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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