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

fill_docx_report

Fill .docx lab report templates in place from JSON while preserving OOXML styling, with optional WPS compatibility sanitization and direct PDF export.

Instructions

Fill a .docx lab report template in-place while preserving its OOXML styling.

Preserves headers, footers, page numbers, table borders, cover underlines, and signature blocks. Optionally applies WPS Office compatibility sanitization and exports directly to PDF.

Args: template_path: Path to the source template .docx file. payload_json: JSON object string with cover_fields, sections (subheading, paragraph, code, image items), and optional keep_together_headings. output_path: Destination path for the filled .docx file. sanitize_wps: Apply 7-point WPS Office compatibility sanitization (default: True). export_pdf_path: Optional destination path to export a PDF after filling. pdf_engine: PDF engine when export_pdf_path is set: auto, dxpdf, or libreoffice (default: auto).

Returns: Formatted JSON string summarizing filled fields, sections, inserted images, WPS audit status, and optional PDF export details.

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": {
      "template_path": "<template_path>",
      "payload_json": "<payload_json>",
      "output_path": "<output_path>"
    },
    "name": "fill_docx_report"
  }
}

Input Schema

NameRequiredDescriptionDefault
pdf_engineNoauto
output_pathYes
payload_jsonYes
sanitize_wpsNo
template_pathYes
export_pdf_pathNo

Output Schema

NameRequiredDescriptionDefault
resultYes

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?

There are no annotations, so the description must carry the full behavioral load, and it discloses a lot: the elements preserved (headers, footers, page numbers, table borders, cover underlines, signature blocks), the optional WPS sanitization, and the PDF export side effect. It does not address whether an existing file at output_path is overwritten, whether the source template is modified, or what happens when placeholders are missing.

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?

The definition is front-loaded with the core action and scoping trait before the Args block, and each argument line carries information not available elsewhere. That information is slightly redundant, because the same styling and PDF details appear in both the prose and the Returns sections, but it remains readable rather than padded.

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?

This is a no-annotation, mutation-style tool with six parameters, and the description compensates well, including payload schema, defaults, and a return summary. A few points remain unanswered — overwrite semantics on output_path, external dependencies for PDF export — that would matter before an agent commits to a write operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, so the description must document parameters from scratch, and it does: all six parameters are explained, including defaults for sanitize_wps and pdf_engine, the enum values auto/dxpdf/libreoffice, and the internal structure of payload_json. An agent can build a valid call from the description alone.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The definition uses a specific verb and resource ("Fill a .docx lab report template in-place while preserving its OOXML styling") and makes the distinguishing trait explicit (styling preservation). It does not name any sibling, so an agent must infer the boundary with convert_docx_to_pdf, especially because this tool can also export to PDF via export_pdf_path.

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?

The usage context is implied by "lab report template," but the definition gives no explicit when-to-use or when-not-to-use guidance. It never states the relationship to siblings such as inspect_docx_template or convert_docx_to_pdf, nor does it say whether the template must first be inspected to satisfy the payload contract.

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