Skip to main content
Glama

Markdown to PDF

markdown_to_pdf
Idempotent

Converts Markdown text or a Markdown file into a PDF with formatted tables, math, diagrams, images and code, then reports the PDF page count and rendering warnings.

Instructions

Converts Markdown (text or a file) to a PDF with RayoMD and returns the PDF's page count and warnings. Renders: GitHub Markdown (tables, task lists, footnotes, alerts > [!NOTE]), PNG/JPEG/SVG images with alt text (relative paths inside the Markdown file's folder), TeX math ($...$, $$...$$ on own lines, math), mermaid flowchart/graph, sequenceDiagram and pie, code colouring in 29 languages, page breaks (\pagebreak, ), [TOC], YAML front matter (title, author, lang) as PDF metadata. Degrades: CSS/HTML layout (text kept), LaTeX packages and macros, other Mermaid types (printed as code), SVGs needing scripts. Full list: resource rayomd://syntax.

Input Schema

NameRequiredDescriptionDefault
tocNoA table of contents first, or at a [TOC] paragraph
pathNoA Markdown file to convert (give this or markdown)
pdfaNoPDF/A-3b: every font embedded
pdfuaNoPDF/UA-1, tagged for screen readers (formulas as TeX source)
styleNoLook of the document (default elegant)
marginNocompact, normal (default), wide, or margin=N in inches or margin=Npt: margin=0.75in, margin=54pt
outputYesThe PDF to write, ending in .pdf; an existing file is replaced
dialectNogithub (default), or obsidian: callouts, ==highlights==, %%comments%%, [[wiki links]], ![[embeds]]
diagramsNoDraw ```mermaid flowcharts, sequence diagrams and pie charts (default true)
markdownNoThe Markdown text (give this or path)
footnotesNoend (default): after the text; page: at the foot of the page of the first reference
page_sizeNoa4 (default), a3, a5, letter or legal, each also with -landscape; WIDTHxHEIGHT in mm, cm, in or pt (210x297mm); or WIDTHxauto (210mmxauto: one long page)
toc_depthNoHeading levels the table of contents lists (default 3)
black_textNoFor black-and-white printers: text, links and code black, fills light grey
source_pathNoWith markdown: the .md file the text stands for; relative images resolve from its folder. Default: output with .md
page_numbersNo"N / M" at the foot of every page
highlight_codeNoColour fenced code by language (default true)
number_headingsNoNumber the headings of this many levels: 1, 1.1, 1.1.1
page_break_beforeNoA new page before each heading of level 1 to N (h1: chapters)

Output Schema

NameRequiredDescriptionDefault
msYesBuild time in milliseconds
codeYesrayomd exit code: 0 ok, 2 bad request, 3 input not readable, 10+N build error, 12 output not writable
bytesYes
errorNo
inputYesThe input path, or the source_path of Markdown text
pagesYes
outputYesThe PDF written
statusYes
failed_imagesYesImages that could not be loaded (their alt text is printed)
missing_charactersYesCharacters without a glyph in the fonts found (drawn as a base letter or ?)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/5.0
Behavior4/5

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

Annotations already declare non-read-only, idempotent, non-destructive, closed-world, so safety is covered. The description adds real behavioral value beyond that: it discloses the rendering support matrix and, more importantly, an explicit degradation list (CSS/HTML layout, LaTeX packages, non-flowchart Mermaid, script-dependent SVGs) plus the return values, so an agent can predict silent quality loss. It does not mention performance, file-size limits, or failure modes, which keeps it below 5.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The first sentence is well front-loaded, but the remainder is one long run-on catalogue of syntax features with semicolon-and-comma chaining that is hard to scan. Much of that catalogue is duplicated by the referenced resource rayomd://syntax, so the listing is informative but not tightly curated.

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?

For a 19-parameter converter with an output schema and full schema coverage, the description covers what matters: purpose, capability envelope, degradation, and a pointer to a resource for the exhaustive syntax list. Only the missing sibling routing and parameter-interaction notes keep it from being complete.

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, and the description meaningfully exceeds it: it explains that relative image paths resolve from the Markdown file's folder (clarifying how path vs markdown vs source_path interact), and it ties dialect to concrete syntax sets (obsidian callouts, ==highlights==, [[wiki links]]) and diagrams to the Mermaid types actually drawn. It still does not explain interaction between toc, toc_depth and a [TOC] paragraph, or defaults for the boolean flags.

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?

States a specific verb and resource ('Converts Markdown ... to a PDF with RayoMD') plus the return payload (page count and warnings). The scope (text or file, single document) is distinguishable from siblings like book_to_pdf and recover_markdown, and the supported/dialect surface tells an agent exactly what class of document this handles.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied by the purpose but never stated: there is no guidance on when to pick this over book_to_pdf, or when recover_markdown should come first. The closest thing to routing guidance is the parameter-level hint 'give this or path' / 'give this or markdown', which helps invocation but not tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.