Skip to main content
Glama
shuji-bonji

pdf-writer-mcp

by shuji-bonji

Ensure PDF/A (archival conformance scaffold)

ensure_pdfa
Idempotent

Adds PDF/A document-level metadata (ID, sRGB OutputIntent, XMP pdfaid) to an existing PDF for chosen flavour (3b, 4, 4f), preparing for conformance validation without altering content or structure.

Instructions

Put an existing PDF onto the PDF/A "vessel" (the PDF/A counterpart of ensure_tagged). Choose the flavour: "pdfa-3b" (default) / "pdfa-4" / "pdfa-4f". Supplies only the missing document-level requirements: the trailer /ID (ISO 32000-1 14.4), an sRGB OutputIntent (GTS_PDFA1; an ICC profile is generated and embedded), and XMP pdfaid. The -4 flavours additionally set the header to PDF 2.0 and delete the Info dictionary (-4 forbids Info unless the catalog has /PieceInfo — stricter than ISO 32000-2 14.3.3). Content, structure tree and fonts are never touched. Documents with attachments must use "pdfa-4f" — plain "pdfa-4" requires every attachment to be PDF/A itself, so bundling CSV or JSON (the Japanese e-bookkeeping-law pattern) would not conform. IMPORTANT: this is preparation for claiming PDF/A, not a guarantee of conformance. Violations such as unembedded fonts, encryption, JavaScript or LZW are not repaired. Writing pdfaid into XMP is the document claiming "I am PDF/A" — applied to a non-conforming document it produces a PDF that lies about itself (which is why a warning is always returned). Always confirm with pdf-verify-mcp's validate_conformance (flavour: the same value) — the verdict is veraPDF's, and since ISO 19005 clauses cannot be quoted, the strongest statement is "veraPDF judged it so". In the e-bookkeeping-law context, apply it after attaching machine-readable data with attach_file. For signed PDFs, preserveSignatures: true (approval signatures only; certification signatures are refused). However, the -4 flavours combined with preserveSignatures are refused unless the input is already PDF 2.0 (an incremental update cannot rewrite the file header, and rewriting it would break the signatures).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
flavourNoThe PDF/A to claim. Default "pdfa-3b". "pdfa-4" (ISO 19005-4) is built on PDF 2.0, so beyond /ID, OutputIntent and XMP pdfaid it **sets the header to 2.0 and drops the Info dictionary** (-4 forbids Info unless PieceInfo is present). **-4 has no conformance level**, so pdfaid:rev is written instead of pdfaid:conformance. **Documents with attachments must use "pdfa-4f"** — plain "pdfa-4" requires every attachment to be PDF/A itself, so bundling JSON or CSV (the Japanese e-bookkeeping-law pattern) would not conform. Combination with preserveSignatures is refused unless the input is already PDF 2.0 (an incremental update cannot rewrite the header, and rewriting it would break the signatures).
inputPathYesAbsolute path of the target PDF.
outputPathNoDestination file path (absolute). When omitted, a base64 string is returned instead.
returnBase64NoWhen true, include a base64 string in the result in addition to saving.
preserveSignaturesNoEdit a signed PDF via an incremental update (appending) without invalidating existing signatures. Default false. The original bytes are untouched, so /ByteRange holds. Changes beyond the certification (DocMDP) permission level are refused.
allowBreakingSignaturesNoWhen the target is digitally signed (detected via /ByteRange), the default is an error. Set true to proceed, accepting that the signatures become invalid.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.21.2

TDQS

A4.7/5.0
Behavior5/5

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

The description goes far beyond the annotations by disclosing that the tool is only a scaffold, not a conformance guarantee; that writing pdfaid creates a 'PDF that lies about itself' on non-conforming input; and that a warning is always returned. It also details signature handling (incremental update, approval-only, refusal conditions) and explicitly states content, structure tree, and fonts are never touched.

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 dense and often redundant with the schema's parameter descriptions, especially the flavour explanation which is nearly duplicated verbatim. While the caveats are important and the bolded emphasis aids navigation, the text is a wall of detail that could be tightened by removing schema-echoed content without losing risk-critical guidance.

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

Completeness5/5

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

Given the tool's complexity, the description covers all essential operational context: prerequisites, limitations, post-verification steps, signature edge cases, and the non-conformance warning behavior. No output schema exists, but the input schema already documents return behavior, so the absence of return-type detail is not a gap; the description fully equips an agent to invoke the tool correctly.

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 the baseline is 3; the description adds meaningful cross-parameter constraints, most notably the refusal of -4 flavours combined with preserveSignatures unless the input is already PDF 2.0. It also clarifies the flavour-attachment relationship and reinforces the base64-return behavior, providing value beyond the individual parameter descriptions.

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?

The description opens with a specific verb and resource: 'Put an existing PDF onto the PDF/A vessel', and explicitly positions itself as 'the PDF/A counterpart of ensure_tagged', distinguishing it from that sibling. It enumerates the exact document-level requirements supplied (trailer /ID, sRGB OutputIntent, XMP pdfaid), leaving no ambiguity about scope.

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

Usage Guidelines5/5

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

The description gives explicit when-to-use guidance: apply after attach_file in the e-bookkeeping context, and always confirm with pdf-verify-mcp's validate_conformance. It spells out exclusions — certification signatures are refused, and -4 flavours with preserveSignatures are refused unless the input is already PDF 2.0 — and explains flavour selection for attachments, making alternative choices concrete.

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