Skip to main content
Glama

download_template

Download the original source file of a Carbone template by providing a Template ID or Version ID. Use it to inspect, edit, or back up your templates.

Instructions

Download the original source file of a stored Carbone template (e.g. the DOCX, XLSX, PPTX, or HTML file that was uploaded). Use this to inspect, edit, or back up a template. Pass a Template ID to download the currently deployed version, or a Version ID to download a specific version.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
templateIdYesTemplate ID (64-bit) or Version ID (SHA-256) to download. Template ID — downloads the currently deployed version of the template. Version ID — downloads that exact version regardless of deployment status. Both formats are returned by upload_template and list_templates.

Implementation Reference

  • The main handler function for the download_template tool. It calls the CarboneClient to download a template by ID (template ID or version ID), extracts the file extension, converts the binary buffer to a tool content result, and returns it. On error, it returns an isError response with the formatted error message.
    export async function handleDownloadTemplate(
      args: { templateId: string },
      client: CarboneClient,
      options?: CallOptions
    ) {
      try {
        const result = await client.downloadTemplate(args.templateId, options);
        const ext = result.filename.split('.').pop() ?? 'bin';
        const content = toToolContent(result.buffer, result.filename, ext);
        return { content: [content] };
      } catch (error) {
        return {
          isError: true,
          content: [{ type: 'text' as const, text: formatError(error) }],
        };
      }
    }
  • The Zod schema definition for the download_template tool's input. It expects a single 'templateId' field (string, min length 1) that can be a Template ID or Version ID.
    export const downloadTemplateSchema = {
      templateId: z
        .string()
        .min(1)
        .describe(
          'Template ID (64-bit) or Version ID (SHA-256) to download. ' +
          'Template ID — downloads the currently deployed version of the template. ' +
          'Version ID — downloads that exact version regardless of deployment status. ' +
          'Both formats are returned by upload_template and list_templates.'
        ),
    };
  • Registration of the download_template tool with the MCP server, connecting the tool name, description, schema, and handler function.
    server.registerTool(
      downloadTemplateToolName,
      { description: downloadTemplateDescription, inputSchema: downloadTemplateSchema },
      (args, extra) => handleDownloadTemplate(args, client, { apiKey: extra.authInfo?.token })
    );
  • The CarboneClient method that makes the actual HTTP GET request to /template/{id} and handles the binary response, returning a buffer and filename.
    async downloadTemplate(
      templateId: string,
      options?: CallOptions
    ): Promise<{ buffer: Buffer; filename: string }> {
      const response = await this.request(`/template/${templateId}`, {
        method: 'GET',
      }, options);
      return this.handleBinaryResponse(response);
    }
  • A secondary Zod validation schema (DownloadTemplateSchema) defined in the validation module, used for input validation of the templateId parameter.
    export const DownloadTemplateSchema = z.object({
      templateId: z.string().min(1, 'Template ID required'),
    });
Behavior3/5

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

Discloses key behavior (downloads currently deployed or specific version) but lacks details on response format (e.g., binary stream), error handling, or authentication needs. With no annotations, more behavioral context would be helpful.

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?

Three concise sentences with front-loaded purpose: first sentence states action, second adds use cases, third explains parameter variants. No unnecessary 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?

Covers purpose, usage, and parameter differentiation adequately for a single-parameter tool. Lacks explicit mention of return format, but given no output schema, the description is mostly complete.

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

Parameters4/5

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

Description adds value beyond the schema by explaining the deployment status logic for each ID format. The schema already covers the parameter, but the description clarifies when to use each, justifying an above-baseline score.

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 specifies 'Download the original source file of a stored Carbone template' with concrete formats (DOCX, XLSX, etc.), clearly distinguishing it from siblings like convert_document or render_document.

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?

Explicitly states use cases ('inspect, edit, or back up') and explains when to use Template ID vs Version ID. Does not explicitly mention when not to use, but context is clear for a download tool.

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/carboneio/carbone-mcp'

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