Skip to main content
Glama
docx-lab-mcp
by eljcf

convert_docx_to_pdf

Convert .docx files to high-fidelity PDF without Word or WPS, with optional PNG page previews and automatic engine fallback.

Instructions

Convert a .docx file to high-fidelity PDF and optionally render PNG previews.

Uses the Rust+Skia dxpdf engine by default without requiring Microsoft Word or WPS Office, with automatic LibreOffice headless fallback when engine="auto".

Args: docx_path: Path to the input .docx file. pdf_path: Destination path for the output .pdf file. engine: Conversion engine: auto, dxpdf, or libreoffice (default: auto). preview_dir: Optional directory path to render each PDF page as a PNG for visual verification. dpi: Resolution in DPI for rendered preview PNGs (default: 150).

Returns: Formatted JSON string containing conversion metadata and optional preview_pages paths.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "docx_path": "<docx_path>",
      "pdf_path": "<pdf_path>"
    },
    "name": "convert_docx_to_pdf"
  }
}

Input Schema

NameRequiredDescriptionDefault
dpiNo
engineNoauto
pdf_pathYes
docx_pathYes
preview_dirNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses that no Word/WPS install is required, that engine='auto' triggers an automatic LibreOffice headless fallback, that previews render per PDF page, and that the return is JSON with conversion metadata. Gaps remain on file-overwrite semantics (what happens if pdf_path exists) and failure behavior, which matter for a tool that writes to disk.

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

Conciseness4/5

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

Front-loaded with the one-line purpose, then a clean Args/Returns structure where each entry maps to a real parameter. Slightly verbose in the engine paragraph, but no sentence is filler.

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?

An output schema exists, yet the description still clarifies that the return is a formatted JSON string with metadata and optional preview_pages. For a five-parameter file-transformation tool with no annotations, the main remaining gap is write/overwrite and error semantics.

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 0%, so the description must compensate, and it does: every one of the five parameters is explained, including the engine's meaningful values (auto/dxpdf/libreoffice), which the schema does not enumerate, and the default DPI of 150. It stops short of stating a valid DPI range or the tradeoffs between engines.

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 ('Convert a .docx file to high-fidelity PDF') plus a secondary capability ('optionally render PNG previews'). The conversion/preview focus clearly separates it from the sibling tools (audit, fill, inspect) that the agent could otherwise confuse with document handling.

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 context is implied rather than stated: the engine/fallback discussion tells the agent when the default path applies, and the preview_dir parameter hints at a visual-verification workflow. There is no explicit when-to-use vs. when-not guidance, and no prerequisites (e.g. whether the input must be a template vs. a filled report) are spelled out.

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