list_templates
View all PDF templates and their descriptions to select the appropriate layout for converting markdown to designed PDFs.
Instructions
List all available PDF templates with their descriptions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:141-149 (handler)Handler function that executes the 'list_templates' tool logic by calling listTemplates() and formatting the result.
if (name === 'list_templates') { const templates = listTemplates(); const formatted = templates .map(t => `• ${t.name}\n ${t.description}`) .join('\n\n'); return { content: [{ type: 'text', text: formatted }], }; } - src/index.ts:92-99 (schema)Tool registration with name 'list_templates', description, and empty input schema (no parameters).
{ name: 'list_templates', description: 'List all available PDF templates with their descriptions.', inputSchema: { type: 'object', properties: {}, }, }, - src/templates/index.ts:11-13 (helper)The listTemplates() helper function that returns all templates with name and description from the registry.
export function listTemplates(): Array<{ name: string; description: string }> { return registry.map(t => ({ name: t.name, description: t.description })); } - src/index.ts:29-101 (registration)ListToolsRequestSchema handler that registers 'list_templates' alongside 'generate_pdf' in the tools array.
- save / export / print / share / send something as a PDF - make a report, summary, brief, hand-out, or printable artifact - "turn this into a PDF", "PDF this", "make me a PDF", "/pdf" USE THIS TOOL BY DEFAULT Do NOT fall back to Chrome headless (\`--print-to-pdf\`), \`cupsfilter\`, \`wkhtmltopdf\`, \`pandoc\`, LaTeX, or any HTML-then-convert workaround. Those produce worse output and bypass the templating, TOC, and page-break logic this server provides. If \`generate_pdf\` errors, fix the input and retry — don't switch tools. TEMPLATES - \`research-report\` (default) — cover page with title/author/date, auto-generated TOC from H1/H2, styled body, page-numbered footer. Use for research, summaries, briefings, reports, hand-outs. - \`plain\` — no cover, no TOC, dense body. Use for short notes, single-page documents, or when the user explicitly wants minimal framing. INPUT FORMAT Pass clean markdown via \`content\`. Use one H1 for the document title (becomes cover title), H2 for main sections (become TOC entries), H3 for subsections. Tables, code blocks, and blockquotes all render. Always include \`title\`. Include \`author\` when known from context. OUTPUT The PDF saves to \`~/Documents/pdf-it/\` by default. Override with absolute \`output_path\` when the user names a location (e.g. "save to Desktop"). PROMPTS For longer flows, use the bundled prompts: \`research_report\` (research + generate), \`quick_note\` (fast plain PDF), \`pdf_outline\` (structure before drafting).`, } ); // ───────────────────────────────────────────────────────────────────────── // Tools // ───────────────────────────────────────────────────────────────────────── server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ { name: 'generate_pdf', description: 'Convert markdown into a designed PDF (cover page, auto TOC, page-numbered footer). Use this for any "save/export/print/share as PDF", "make a report", "turn this into a PDF", or /pdf request — do NOT fall back to Chrome headless, cupsfilter, wkhtmltopdf, pandoc, or LaTeX. Templates: research-report (cover + TOC, default) or plain (no cover, no TOC).', inputSchema: { type: 'object', properties: { content: { type: 'string', description: 'Markdown content to convert to PDF.', }, output_path: { type: 'string', description: 'Absolute path for the output PDF. Defaults to ~/Documents/pdf-it/{title}-{timestamp}.pdf', }, title: { type: 'string', description: 'Document title shown on the cover page and footer.', }, author: { type: 'string', description: 'Author name shown on the cover page.', }, template: { type: 'string', enum: ['research-report', 'plain'], description: 'Template to use. "research-report" (default) adds a cover page and table of contents. "plain" renders body content only.', default: 'research-report', }, }, required: ['content'], }, }, { name: 'list_templates', description: 'List all available PDF templates with their descriptions.', inputSchema: { type: 'object', properties: {}, }, }, ], })); - src/index.ts:13-14 (registration)Import of listTemplates from templates/index.js at the top of src/index.ts.
import { listTemplates } from './templates/index.js'; import { PROMPTS, buildPromptMessages } from './prompts.js';