Skip to main content
Glama

download_template

Download the original source file of a Carbone template, like DOCX or HTML, using a template ID or version ID to inspect, edit, or back it up.

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

  • Handler function that calls the CarboneClient to download a template and returns the file content as tool content.
    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) }],
        };
      }
    }
  • Input schema defining the templateId parameter (accepts Template ID or Version ID) for the download_template tool.
    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.'
        ),
    };
  • Validation schema for download_template using Zod, requiring a non-empty templateId string.
    export const DownloadTemplateSchema = z.object({
      templateId: z.string().min(1, 'Template ID required'),
    });
  • Registration of the download_template tool with the MCP server, wiring up name, description, schema, and handler.
    server.registerTool(
      downloadTemplateToolName,
      { description: downloadTemplateDescription, inputSchema: downloadTemplateSchema },
      (args, extra) => handleDownloadTemplate(args, client, { apiKey: extra.authInfo?.token })
    );
  • CarboneClient method that performs the actual HTTP GET request to /template/{id} and returns the binary file 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);
    }
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 discloses behavioral details like downloading the currently deployed version vs exact version regardless of deployment status. However, it does not mention authentication requirements, rate limits, or the response format (e.g., binary download).

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?

The description is two sentences, with the first clearly stating the purpose and examples, and the second giving usage instructions. Every sentence earns its place; no fluff.

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 1-parameter tool with no output schema, the description covers when to use each parameter and common use cases. While it could mention that the response is a binary file, it is otherwise complete for the tool's simplicity.

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?

The schema already describes the parameter well, but the description adds significant value by explaining the distinction between Template ID and Version ID, including the nuance that Version ID works regardless of deployment status. This enriches the agent's understanding beyond the schema.

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 the verb 'download' and the resource 'original source file of a stored Carbone template', listing specific file types and use cases. It distinguishes itself from siblings like upload_template and list_templates by focusing on downloading.

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?

The description provides explicit guidance on when to use Template ID (current version) vs Version ID (specific version), and lists use cases. However, it does not explicitly state when not to use it or mention alternatives like delete_template for removal.

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