Skip to main content
Glama

get_template_details

Read-onlyIdempotent

Show available page sizes and orientations for a template. Use to confirm variant availability before document conversion.

Instructions

Show available variants (page sizes and orientations) for a specific template. All MDMagic templates support the full 5×2 matrix: A3, A4, Executive, US_Legal, US_Letter × Portrait/Landscape. Use this when the user asks 'does this template come in Legal Landscape?' or 'what sizes are available?' — confirms the variant before convert_document runs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
templateNameYesTemplate ID or name (e.g. Executive_Platinum, or a UUID for custom templates)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
templateYes
pageSizesYesSupported page sizes
orientationsYesSupported orientations

Implementation Reference

  • Main handler function that looks up a template by name/ID, fetches built-in and custom templates, matches the requested template, and returns a formatted response showing the full 5x2 page-size/orientation matrix.
    export async function handleGetTemplateDetails(
      apiClient: MDMagicApiClient,
      args: any
    ): Promise<CallToolResult> {
      try {
        const input = getTemplateDetailsSchema.parse(args);
        console.error(`[get_template_details] Looking up: ${input.templateName}`);
    
        const [builtinResp, customResp] = await Promise.all([
          apiClient.getTemplates(),
          apiClient.getCustomTemplates().catch(() => ({ templates: [] }))
        ]);
    
        const all = [...(builtinResp.templates || []), ...(customResp.templates || [])];
        const target = all.find(t =>
          t.id === input.templateName ||
          t.name.toLowerCase() === input.templateName.toLowerCase() ||
          t.id.toLowerCase() === input.templateName.toLowerCase()
        );
    
        if (!target) {
          return {
            content: [{
              type: 'text',
              text: `❌ **Template not found**: \`${input.templateName}\`\n\nCall \`list_all_templates\` to see available templates.`
            }]
          };
        }
    
        const lines = [
          `📐 **Template details: ${target.name}**`,
          '',
          `**ID**: \`${target.id}\``,
          `**Type**: ${target.type === 'built-in' ? '🏢 Built-in' : '🎨 Custom'}`,
        ];
        if (target.category) lines.push(`**Category**: ${target.category}`);
        if (target.description) lines.push(`**Description**: ${target.description}`);
    
        lines.push('');
        lines.push('**Available variants** (all combinations supported):');
        lines.push('');
        lines.push('| Page size | Portrait | Landscape |');
        lines.push('|---|:---:|:---:|');
        PAGE_SIZES.forEach(size => {
          lines.push(`| ${size} | ✅ | ✅ |`);
        });
        lines.push('');
        lines.push(`**Default**: A4, Portrait. Override with the \`pageSize\` and \`orientation\` arguments to \`convert_document\`.`);
    
        return { content: [{ type: 'text', text: lines.join('\n') }] };
      } catch (error: any) {
        console.error('[get_template_details] Error:', error.message);
        throw error;
      }
    }
  • Zod schema defining the input parameter: templateName (string, required).
    export const getTemplateDetailsSchema = z.object({
      templateName: z.string().describe('Template ID or name (e.g. Executive_Platinum, or a UUID for custom templates)')
    });
  • Import of handleGetTemplateDetails from the handler module.
    import { handleGetTemplateDetails } from './getTemplateDetails.js';
  • Case statement in the unified handler switch that routes 'get_template_details' to handleGetTemplateDetails.
    case 'get_template_details':
      return await handleGetTemplateDetails(apiClient, request.params.arguments);
  • src/index.ts:335-363 (registration)
    Tool registration metadata in the ListTools response: name, description, annotations, inputSchema (templateName string), and outputSchema (template object, pageSizes array, orientations array).
      name: "get_template_details",
      description: "Show available variants (page sizes and orientations) for a specific template. All MDMagic templates support the full 5×2 matrix: A3, A4, Executive, US_Legal, US_Letter × Portrait/Landscape. Use this when the user asks 'does this template come in Legal Landscape?' or 'what sizes are available?' — confirms the variant before convert_document runs.",
      annotations: {
        title: "Show template variant matrix",
        readOnlyHint: true,
        destructiveHint: false,
        idempotentHint: true,
        openWorldHint: true
      },
      inputSchema: {
        type: "object" as const,
        properties: {
          templateName: {
            type: "string",
            description: "Template ID or name (e.g. Executive_Platinum, or a UUID for custom templates)"
          }
        },
        required: ["templateName"]
      },
      outputSchema: {
        type: "object" as const,
        properties: {
          template: TEMPLATE_OBJECT_SCHEMA,
          pageSizes: { type: "array", items: { type: "string" }, description: "Supported page sizes" },
          orientations: { type: "array", items: { type: "string" }, description: "Supported orientations" }
        },
        required: ["template", "pageSizes", "orientations"]
      }
    },
Behavior4/5

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

Annotations already declare readOnlyHint, destructiveHint, idempotentHint, openWorldHint. Description adds: all templates support a 5x2 matrix, and it serves as a pre-check for convert_document. This enriches behavioral context without contradiction.

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 sentences, front-loaded with purpose, followed by usage examples. Every sentence is informative and necessary. 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?

Covers purpose, usage, and output context (matrix of sizes). With an output schema present, return details are not needed. Slight gap: no mention of error handling for invalid templates, but overall sufficient for a simple tool.

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

Parameters3/5

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

Schema coverage is 100% with a clear description of templateName. Description doesn't add new parameter details (e.g., format specifics) beyond schema, which is adequate. Baseline 3 applies as schema already covers the parameter.

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?

Description clearly states 'Show available variants (page sizes and orientations) for a specific template', specifying verb and resource. It distinguishes from siblings like list_all_templates and explicitly ties to convert_document, making purpose unambiguous.

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?

Provides explicit example queries ('does this template come in Legal Landscape?') and advises using before convert_document. While it lacks explicit alternatives or when-not-to-use, the context is clear and actionable.

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