Skip to main content
Glama
shuji-bonji

pdf-writer-mcp

by shuji-bonji

Flatten Form

flatten_form
DestructiveIdempotent

Flatten interactive PDF forms to freeze filled values while removing editable fields. Preserve the visual appearance for distribution, with options for CJK text and tagged PDFs.

Instructions

Flatten an existing PDF's interactive form (AcroForm), keeping the filled appearance while removing interactivity. Use it to freeze values before distribution. If existing values contain CJK text, set fontPath or PDF_WRITER_FONT in case appearances must be regenerated. On tagged PDFs, Widget annotations disappear and Form structure elements are left dangling, so it refuses by default (allowBreakingTags: true to force).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fontPathNoFont for appearance regeneration. Falls back to the PDF_WRITER_FONT environment variable, then the standard font. Not needed when existing appearances can be reused, but required for CJK forms that need regeneration.
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.
allowBreakingTagsNoAllow flattening even on a tagged PDF. Default false.
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.4/5.0
Behavior5/5

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

The description adds significant behavioral detail beyond the annotations: it discloses side effects (removal of interactivity, Widget annotation disappearance, dangling Form structure), refusal behavior on tagged PDFs, and signature-breaking consequences. This is especially valuable given destructiveHint and idempotentHint are already present.

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

Conciseness5/5

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

Three sentences, front-loaded with the primary purpose, followed by targeted usage notes. Every sentence contributes meaningful information and there is no redundant repetition of schema content.

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?

The description covers the main purpose, key side effects, refusal conditions, and font caveats. Since the input schema thoroughly explains parameters including base64 return behavior, the description does not need to repeat that; it is complete enough for an agent to select and invoke the tool correctly.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents all six parameters and their meanings. The description adds helpful context for fontPath and allowBreakingTags, but this is augmentative rather than necessary; the baseline of 3 applies.

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 uses a specific verb ('flatten') and a clear resource ('an existing PDF's interactive form (AcroForm)'), and distinguishes the action from fill-related siblings by emphasizing removal of interactivity while preserving filled appearance. It is immediately obvious what the tool accomplishes.

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

Usage Guidelines4/5

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

It gives a concrete use case ('freeze values before distribution') and provides conditional guidance for special cases such as CJK text, fontPath, and tagged PDFs. It does not explicitly name an alternative sibling like fill_form, but the context clearly implies when flattening is appropriate.

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