Skip to main content
Glama

list_templates

List stored Carbone templates with filtering by ID, category, origin, and search by name or ID. Supports cursor-based pagination.

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

  • Handler function for the list_templates tool. Calls client.listTemplates with args, formats the result as JSON text, and appends pagination info if hasMore is true.
    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, hasMore, nextCursor } = await client.listTemplates(args, options);
    
        if (templates.length === 0) {
          return { content: [{ type: 'text' as const, text: 'No templates found.' }] };
        }
    
        let text = JSON.stringify(templates, null, 2);
        if (hasMore && nextCursor) {
          text += `\n\nMore results available. Call list_templates again with cursor="${nextCursor}" to fetch the next page.`;
        }
    
        return { content: [{ type: 'text' as const, text }] };
      } catch (error) {
        return {
          isError: true,
          content: [{ type: 'text' as const, text: formatError(error) }],
        };
      }
    }
  • Input schema (Zod) for the list_templates tool. Defines fields: 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 list_templates tool on the MCP server via server.registerTool(), mapping the name, description, schema, and handler.
    export function registerTools(server: McpServer, client: CarboneClient): void {
      server.registerTool(
        listTemplatesToolName,
        { description: listTemplatesDescription, inputSchema: listTemplatesSchema },
        (args, extra) => handleListTemplates(args, client, { apiKey: extra.authInfo?.token })
      );
  • CarboneClient.listTemplates() - the underlying API call that constructs a GET /templates request with query parameters and returns a parsed TemplateListResponse.
    async listTemplates(params?: {
      id?:              string;
      versionId?:       string;
      category?:        string;
      origin?:          number;
      includeVersions?: boolean;
      search?:          string;
      limit?:           number;
      cursor?:          string;
    }, options?: CallOptions): Promise<TemplateListResponse> {
      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[], hasMore: boolean, nextCursor?: string };
      return { templates: json.data, hasMore: json.hasMore ?? false, nextCursor: json.nextCursor };
    }
  • Type definition for TemplateListResponse used by list_templates: templates array, hasMore flag, and optional nextCursor for pagination.
    export interface TemplateListResponse {
      templates:  TemplateListItem[];
      hasMore:    boolean;
      nextCursor?: string;
    }
Behavior4/5

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

No annotations are provided, so the description carries the full burden. It explains pagination (cursor-based), default behavior for includeVersions, and unsupported tag filtering. It does not mention rate limits or permissions, but for a list operation this is acceptable.

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 concise and well-structured. It starts with the main purpose, then details filtering options, hints at version history, mentions pagination, and ends with a note on limitations. No extraneous 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 8 parameters, each is described in the schema and the description adds useful context. No output schema exists, but cursor pagination explanation compensates. The description is sufficient for an agent to use the tool correctly.

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?

Schema description coverage is 100%, so baseline is 3. The description adds context beyond the schema, e.g., explaining ID formats ('64-bit format' vs 'SHA-256') and clarifying cursor usage. This adds value.

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 function: 'List stored Carbone templates with filtering, search, and pagination.' It specifies actions and resources, and distinguishes from sibling tools like list_tags by noting that tag filtering is not supported.

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 on when to use alternatives: 'filtering by tags is not supported by the Carbone API — use list_tags to discover tags, then filter results manually.' This helps the agent decide which tool to use.

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