get_template_details
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
| Name | Required | Description | Default |
|---|---|---|---|
| templateName | Yes | Template ID or name (e.g. Executive_Platinum, or a UUID for custom templates) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| template | Yes | ||
| pageSizes | Yes | Supported page sizes | |
| orientations | Yes | Supported orientations |
Implementation Reference
- src/tools/getTemplateDetails.ts:13-67 (handler)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; } } - src/tools/getTemplateDetails.ts:6-8 (schema)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)') }); - src/tools/index.ts:11-11 (registration)Import of handleGetTemplateDetails from the handler module.
import { handleGetTemplateDetails } from './getTemplateDetails.js'; - src/tools/index.ts:54-55 (registration)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"] } },