Skip to main content
Glama

list_builtin_templates

Read-onlyIdempotent

List all 15 built-in MDMagic templates grouped by Business, Creative, Professional, and Technical categories. Ideal for viewing bundled templates without user-uploaded ones.

Instructions

List the 15 built-in MDMagic templates, grouped by category. Same as list_all_templates but excludes the user's custom uploads. Use this when the user asks specifically about MDMagic's bundled templates rather than their personal ones.

Categories available: Business (5), Creative (6), Professional (2), Technical (2).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
includeDetailsNoInclude template details like available page sizes and orientations (default: false)
categoryNoOptional filter — return only templates in this category.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
countNoNumber of templates returned
templatesYesMatching built-in templates

Implementation Reference

  • Main handler function `handleListBuiltinTemplates` that executes the tool logic. Fetches built-in templates via `apiClient.getTemplates()`, optionally filters by category, and formats the output using `renderGroupedBuiltins`.
    export async function handleListBuiltinTemplates(
      apiClient: MDMagicApiClient,
      args: any
    ): Promise<CallToolResult> {
      try {
        const input = listBuiltinTemplatesSchema.parse(args);
        console.error(`[list_builtin_templates] Fetching built-in templates${input.category ? ` (category=${input.category})` : ''}...`);
    
        const response = await apiClient.getTemplates();
        let templates = response.templates || [];
    
        if (input.category) {
          templates = templates.filter(
            t => (t.category || '').toLowerCase() === input.category!.toLowerCase()
          );
        }
    
        if (templates.length === 0) {
          const msg = input.category
            ? `📝 **No built-in templates in category "${input.category}"**\n\nValid categories: Business, Creative, Professional, Technical.`
            : "📝 **No built-in templates available**\n\nNo built-in templates found in the system.";
          return { content: [{ type: "text", text: msg }] };
        }
    
        let output = `🏢 **Built-in Templates** (${templates.length} available${input.category ? `, category=${input.category}` : ''})\n\n`;
        output += renderGroupedBuiltins(templates);
        output += '💡 **Usage:** Pass the template ID (in backticks) as `templateName` to `convert_document`.';
    
        return { content: [{ type: "text", text: output }] };
    
      } catch (error: any) {
        console.error('[list_builtin_templates] Error:', error.message);
        throw error;
      }
    }
  • Zod schema `listBuiltinTemplatesSchema` defining input validation: optional `includeDetails` (boolean, default false) and optional `category` filter (enum: Business, Creative, Professional, Technical).
    export const listBuiltinTemplatesSchema = z.object({
      includeDetails: z.boolean().default(false).describe("Include template details"),
      category: z.enum(['Business', 'Creative', 'Professional', 'Technical']).optional().describe("Filter by category: Business (5 templates), Creative (6), Professional (2), Technical (2).")
    });
  • src/index.ts:138-170 (registration)
    Tool definition registered via `getToolDefinitions()` – sets name, description, annotations, inputSchema (includeDetails + category), and outputSchema (count + templates array).
    {
      name: "list_builtin_templates",
      description: "List the 15 built-in MDMagic templates, grouped by category. Same as list_all_templates but excludes the user's custom uploads. Use this when the user asks specifically about MDMagic's bundled templates rather than their personal ones.\n\nCategories available: Business (5), Creative (6), Professional (2), Technical (2).",
      annotations: {
        title: "List built-in MDMagic templates",
        readOnlyHint: true,
        destructiveHint: false,
        idempotentHint: true,
        openWorldHint: true
      },
      inputSchema: {
        type: "object" as const,
        properties: {
          includeDetails: {
            type: "boolean",
            description: "Include template details like available page sizes and orientations (default: false)"
          },
          category: {
            type: "string",
            enum: CATEGORY_ENUM,
            description: "Optional filter — return only templates in this category."
          }
        }
      },
      outputSchema: {
        type: "object" as const,
        properties: {
          count: { type: "integer", description: "Number of templates returned" },
          templates: { type: "array", items: TEMPLATE_OBJECT_SCHEMA, description: "Matching built-in templates" }
        },
        required: ["templates"]
      }
    },
  • Route in the unified handler that dispatches 'list_builtin_templates' to `handleListBuiltinTemplates(apiClient, request.params.arguments)`.
    case 'list_builtin_templates':
      return await handleListBuiltinTemplates(apiClient, request.params.arguments);
  • Helper function `groupByCategory` used to group templates by their category field.
    function groupByCategory(templates: any[]): Record<string, any[]> {
      const grouped: Record<string, any[]> = {};
      templates.forEach(t => {
        const cat = t.category || 'Uncategorized';
        if (!grouped[cat]) grouped[cat] = [];
        grouped[cat].push(t);
      });
      return grouped;
    }
Behavior3/5

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

Annotations already provide readOnlyHint, destructiveHint, idempotentHint, openWorldHint. Description adds category grouping and count details but no additional behavioral caveats.

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?

Two concise sentences with front-loaded purpose and clear structure.

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

Completeness5/5

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

Simple read-only tool with output schema present; description fully covers purpose, usage, and parameter context.

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 coverage 100%, description mentions categories and optional filter, adding grouping and count context beyond 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?

Clearly states it lists the 15 built-in MDMagic templates grouped by category, and distinguishes from list_all_templates and list_custom_templates by excluding custom uploads.

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?

Explicitly says to use this when the user asks about bundled templates rather than personal ones, differentiating from sibling tools.

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/MDMagic-MCP/mdmagic-mcp-server'

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