Skip to main content
Glama

list_templates

Retrieve stored Carbone templates with filters by ID, category, or origin. Supports search and pagination, with optional version history.

Instructions

List stored Carbone templates with filtering, search, and pagination. Filter by Template ID, Version ID, category, or upload origin. Use includeVersions to see the full version history of each template. Supports cursor-based pagination for large collections. Note: filtering by tags is not supported by the Carbone API — use list_tags to discover tags, then filter results manually.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNoFilter by Template ID (64-bit format). Cannot be a Version ID.
versionIdNoFilter by Version ID (SHA-256 format).
categoryNoFilter by category (e.g. "invoices", "legal").
originNoFilter by upload origin. 0 = uploaded via API, 1 = uploaded via Carbone Studio.
includeVersionsNoIf true, returns all versions for each template. Default: false (only deployed version).
searchNoFuzzy search in template names, or exact match on Template ID / Version ID.
limitNoMaximum number of results to return (default: 100).
cursorNoPagination cursor from the previous response nextCursor field. Use to fetch the next page.

Implementation Reference

  • The main handler function for the list_templates tool. Calls client.listTemplates() with the provided args and returns formatted JSON results or an error.
    export async function handleListTemplates(
      args: {
        id?: string;
        versionId?: string;
        category?: string;
        origin?: number;
        includeVersions?: boolean;
        search?: string;
        limit?: number;
        cursor?: string;
      },
      client: CarboneClient,
      options?: CallOptions
    ) {
      try {
        const templates = await client.listTemplates(args, options);
    
        if (templates.length === 0) {
          return { content: [{ type: 'text' as const, text: 'No templates found.' }] };
        }
    
        return {
          content: [{ type: 'text' as const, text: JSON.stringify(templates, null, 2) }],
        };
      } catch (error) {
        return {
          isError: true,
          content: [{ type: 'text' as const, text: formatError(error) }],
        };
      }
    }
  • Input schema for the list_templates tool using Zod. Defines optional filtering parameters: id, versionId, category, origin, includeVersions, search, limit, cursor.
    export const listTemplatesSchema = {
      id: z
        .string()
        .optional()
        .describe('Filter by Template ID (64-bit format). Cannot be a Version ID.'),
      versionId: z
        .string()
        .optional()
        .describe('Filter by Version ID (SHA-256 format).'),
      category: z
        .string()
        .optional()
        .describe('Filter by category (e.g. "invoices", "legal").'),
      origin: z
        .number()
        .int()
        .optional()
        .describe('Filter by upload origin. 0 = uploaded via API, 1 = uploaded via Carbone Studio.'),
      includeVersions: z
        .boolean()
        .optional()
        .describe('If true, returns all versions for each template. Default: false (only deployed version).'),
      search: z
        .string()
        .optional()
        .describe('Fuzzy search in template names, or exact match on Template ID / Version ID.'),
      limit: z
        .number()
        .int()
        .positive()
        .optional()
        .describe('Maximum number of results to return (default: 100).'),
      cursor: z
        .string()
        .optional()
        .describe('Pagination cursor from the previous response nextCursor field. Use to fetch the next page.'),
    };
  • Registration of the list_templates tool in the MCP server via server.registerTool(). Links the tool name, schema, and handler together.
    server.registerTool(
      listTemplatesToolName,
      { description: listTemplatesDescription, inputSchema: listTemplatesSchema },
      (args, extra) => handleListTemplates(args, client, { apiKey: extra.authInfo?.token })
    );
  • The CarboneClient.listTemplates() method that makes the actual HTTP GET request to /templates with query parameters, returning TemplateListItem[].
    async listTemplates(params?: {
      id?:              string;
      versionId?:       string;
      category?:        string;
      origin?:          number;
      includeVersions?: boolean;
      search?:          string;
      limit?:           number;
      cursor?:          string;
    }, options?: CallOptions): Promise<TemplateListItem[]> {
      const query = new URLSearchParams();
      if (params?.id)                            query.set('id',              params.id);
      if (params?.versionId)                     query.set('versionId',       params.versionId);
      if (params?.category)                      query.set('category',        params.category);
      if (params?.origin !== undefined)          query.set('origin',          String(params.origin));
      if (params?.includeVersions !== undefined) query.set('includeVersions', String(params.includeVersions));
      if (params?.search)                        query.set('search',          params.search);
      if (params?.limit)                         query.set('limit',           String(params.limit));
      if (params?.cursor)                        query.set('cursor',          params.cursor);
    
      const url = `/templates${query.size ? `?${query}` : ''}`;
      const response = await this.request(url, { method: 'GET' }, options);
    
      const json = await response.json() as { data: TemplateListItem[] };
      return json.data;
    }
  • Type definition for TemplateListItem, which is the return type of the list_templates tool (and the Carbone API response shape).
    export interface TemplateListItem {
      id: string;
      versionId: string;
      deployedAt?: number;
      createdAt?: number;
      expireAt?: number;
      size?: number;
      type?: string;
      name?: string;
      category?: string;
      comment?: string;
      tags?: string[];
      origin?: number;
    }
Behavior4/5

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

No annotations provided, so description carries full burden. Discloses cursor-based pagination, default limit, and includeVersions behavior. Lacks explicit mention of return structure but is adequate for a read-only list tool.

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 that front-load the main purpose, then add key details. 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?

Given no output schema, description could be more explicit about return data (e.g., list of templates with fields). However, pagination cursor hint implies structure. Still somewhat complete for a list operation.

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

Parameters5/5

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

Schema coverage is 100%, but description adds value beyond schema: clarifies tag filtering limitation, pagination cursor usage from previous response, and the version history behavior of includeVersions.

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 tool lists templates with filtering, search, and pagination. It distinguishes itself from siblings like list_tags by explicitly noting that tag filtering is unsupported and directing to list_tags.

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

Usage Guidelines5/5

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

Provides explicit guidance: mentions that filtering by tags is not supported and suggests using list_tags to discover tags and filter manually. Also implies when to use pagination with cursor-based approach.

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