Skip to main content
Glama
guanweiqiang

document-converter-mcp

by guanweiqiang

Convert Markdown to PDF

markdown_to_pdf
Read-onlyIdempotent

Convert Markdown files to PDF documents with customizable page size, table of contents, and CJK font support using Pandoc.

Instructions

Convert a Markdown file to PDF format using Pandoc. Arguments:

  • inputPath (string, required): Path to the input Markdown file (relative to workspace)

  • outputPath (string, optional): Path for the output PDF. Defaults to same name with .pdf extension

  • title (string, optional): Document title for the PDF metadata

  • toc (boolean, optional): Include a table of contents

  • pageSize (enum, optional): Page size — 'A4' or 'Letter'. Defaults to 'A4'

  • theme (enum, optional): Theme — 'default', 'github', or 'academic'. Currently informational

  • pdfEngine (enum, optional): PDF engine — 'pdflatex', 'xelatex', 'lualatex', 'wkhtmltopdf', 'weasyprint', or 'typst'. Leave unset to let Pandoc choose

  • cjkMainFont (string, optional): CJK main font used by xelatex for Chinese/Japanese/Korean PDF output. Example: 'Microsoft YaHei', 'SimSun', 'Noto Sans CJK SC'

  • preserveSource (boolean, optional): When true, save the original Markdown as a sidecar file (e.g. sample.pdf.source.md) for accurate PDF-to-Markdown recovery. Defaults to false

  • strictMarkdown (boolean, optional): If true, reject files with structural issues (unclosed code blocks). Defaults to false

  • overwrite (boolean, optional): Allow overwriting existing output. Defaults to false

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputPathYesPath to the input Markdown file (relative to workspace)
outputPathNoPath for the output PDF file (relative to workspace). Auto-derived if omitted.
titleNoDocument title for PDF metadata
tocNoInclude a table of contents
pageSizeNoPage size for the PDF
themeNoVisual theme (via CSS)
pdfEngineNoPDF rendering engine to use. Leave unset to let Pandoc choose automatically.
cjkMainFontNoCJK main font for Chinese/Japanese/Korean PDF output (used by xelatex). Example: 'Microsoft YaHei', 'SimSun', 'Noto Sans CJK SC'.
preserveSourceNoWhen true, save the original Markdown as a sidecar file (e.g. sample.pdf.source.md) for accurate PDF-to-Markdown recovery. Defaults to false.
strictMarkdownNoIf true, reject input if Markdown has structural issues like unclosed code blocks.
overwriteNoAllow overwriting existing output file. Defaults to false.
Behavior1/5

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

Annotations include readOnlyHint=true, but the description implies creating an output file (conversion to PDF). This is a contradiction. The description fails to clarify side effects like file creation, overwriting, or the use of external tools (Pandoc).

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 description is front-loaded with the purpose sentence, but the rest is a parameter list that largely repeats the schema. It could be more concise by grouping related options or removing redundant explanations.

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

Completeness3/5

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

Covers all 11 parameters with some added context. However, lacks behavioral information (e.g., what happens if output exists, dependencies on Pandoc installation) and usage scenarios. Output schema is absent, but schema coverage is high.

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 is 100%. The description adds value by stating defaults (pageSize defaults to 'A4'), providing examples (cjkMainFont), and clarifying behavior (leave pdfEngine unset for auto). This exceeds the baseline 3.

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 converts a Markdown file to PDF using Pandoc. The verb 'Convert' and resource 'Markdown file to PDF format' are specific. This distinguishes it from sibling tools like markdown_to_html or docx_to_markdown.

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

Usage Guidelines2/5

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

No explicit guidance on when to use this tool versus alternatives like batch_convert. The description only lists parameters without context for selection.

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/guanweiqiang/document-convert-mcp'

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