Skip to main content
Glama

pdf_flatten_batch

Flatten PDFs (Batch) — Apply the same flatten configuration to up to 20 PDFs in one request. Returns a ZIP with each flattened file (and per-file error entries on failure). [category: pdf]

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeNoWhich interactive elements to flatten. 'none' runs no flatten (useful for OCR/watermark/PDFA-only pipelines).all
filesYesUp to 20 input PDFs
pagesNoOptional page range (e.g. '1-3,5,7-9'). Only listed pages are flattened; others stay interactive.
ocrLangNoWhich language the scanned text is in.eng
ocrFirstNoRun ocrmypdf before flattening (for scanned PDFs). Requires Starter+ tier.
exportDataNoAlso give me the form answers and note text as separate files. You get a ZIP containing the flattened PDF plus form_values.json and annotations.json - not a PDF.
outputFormatNopdfa produces a PDF/A-2b archival output. Requires Starter+ tier.pdf
preserveLinksNoKeep clickable hyperlinks after flattening (uses qpdf --flatten-annotations=print).
signatureModeNoWhat to do if the PDF has been digitally signed. Flattening destroys a signature, so by default we hand the original back untouched.preserve
watermarkFontNoExactly Helvetica, Times-Roman, or Courier (case-sensitive); anything else becomes Helvetica. Read only when watermarkText is set.Helvetica
watermarkTextNoText watermark to stamp before flattening. Leave empty to skip.
compressImagesNoDownsample images after flattening to shrink file size.
compressPresetNoHow hard to squeeze the pictures: screen 72 DPI, ebook 150 DPI, printer and prepress 300 DPI.ebook
outputFilenameNoOptional custom filename for the flattened output (without path).
watermarkColorNoHex color, #rgb or #rrggbb.#808080
watermarkScaleNoAbsolute scale factor; default 1.0. Non-numeric resets to 1.0.
watermarkOpacityNo0 = invisible, 1 = solid; default 0.3. Non-numeric resets to 0.3. Read only when watermarkText is set.
watermarkFontSizeNoPoint size, integer; non-integer input silently resets to 48. Read only when watermarkText is set.
watermarkPositionNoWhere the watermark sits on the page. Only used when there is watermark text.c
watermarkRotationNoDegrees, integer; default 45 = classic diagonal. Non-integer resets to 45. Read only when watermarkText is set.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • addedInput schema / properties / pages / title
      Added value: +"Pages to flatten"
    • addedInput schema / properties / pages / x-ui / no_recall
      Added value: +true
    • addedInput schema / properties / pages / x-ui / page_select
      Added value: +{}
  2. Changed2 schema fields changed
    • addedInput schema / properties / outputFilename / x-ui
      Added value: +{
      +  "unset_label": "Named after your file"
      +}
    • addedInput schema / properties / pages / x-ui
      Added value: +{
      +  "unset_label": "All pages"
      +}
  3. Changed3 schema fields changed
    • addedInput schema / properties / watermarkFontSize / x-ui
      Added value: +{
      +  "unit": "pt"
      +}
    • addedInput schema / properties / watermarkRotation / x-ui
      Added value: +{
      +  "unit": "deg"
      +}
    • addedInput schema / properties / watermarkScale / x-ui
      Added value: +{
      +  "unit": "x"
      +}
  4. Changed11 schema fields changed
    • changedInput schema / properties / compressPreset / description
      Previous value: -"screen|ebook|printer|prepress (Ghostscript). Read only when compressImages=true; unknown → ebook. screen=72dpi, printer/prepress=300dpi."New value: +"How hard to squeeze the pictures: screen 72 DPI, ebook 150 DPI, printer and prepress 300 DPI."
    • addedInput schema / properties / compressPreset / x-show-when
      Added value: +{
      +  "compressImages": [
      +    "true"
      +  ]
      +}
    • changedInput schema / properties / exportData / description
      Previous value: -"Return a ZIP containing the flattened PDF plus form_values.json and annotations.json side files."New value: +"Also give me the form answers and note text as separate files. You get a ZIP containing the flattened PDF plus form_values.json and annotations.json - not a PDF."
    • changedInput schema / properties / ocrLang / description
      Previous value: -"Allowlist: eng fra spa deu ita por nld pol chi_sim jpn kor ara rus hin; unknown → eng. Read only when ocrFirst=true (paid OCR tier)."New value: +"Which language the scanned text is in."
    • addedInput schema / properties / ocrLang / x-show-when
      Added value: +{
      +  "ocrFirst": [
      +    "true"
      +  ]
      +}
    • addedInput schema / properties / ocrLang / x-ui
      Added value: +{
      +  "labels": {
      +    "ara": "Arabic",
      +    "chi_sim": "Chinese (Simplified)",
      +    "deu": "German",
      +    "eng": "English",
      +    "fra": "French",
      +    "hin": "Hindi",
      +    "ita": "Italian",
      +    "jpn": "Japanese",
      +    "kor": "Korean",
      +    "nld": "Dutch",
      +    "pol": "Polish",
      +    "por": "Portuguese",
      +    "rus": "Russian",
      +    "spa": "Spanish"
      +  }
      +}
    • changedInput schema / properties / signatureMode / description
      Previous value: -"preserve = return original when signatures detected; ignore = flatten anyway (invalidates sigs); block = 409 error."New value: +"What to do if the PDF has been digitally signed. Flattening destroys a signature, so by default we hand the original back untouched."
    • addedInput schema / properties / signatureMode / x-ui
      Added value: +{
      +  "labels": {
      +    "block": "Stop and tell me",
      +    "ignore": "Flatten anyway (breaks the signature)",
      +    "preserve": "Leave signed files untouched"
      +  }
      +}
    • changedInput schema / properties / watermarkPosition / description
      Previous value: -"pdfcpu anchor: c tl tc tr ml mr bl bc br (ml/mr are folded to the engine's l/r); unknown → c (center). Read only when watermarkText is set."New value: +"Where the watermark sits on the page. Only used when there is watermark text."
    • addedInput schema / properties / watermarkPosition / x-ui
      Added value: +{
      +  "labels": {
      +    "bc": "Bottom centre",
      +    "bl": "Bottom left",
      +    "br": "Bottom right",
      +    "c": "Centre",
      +    "ml": "Middle left",
      +    "mr": "Middle right",
      +    "tc": "Top centre",
      +    "tl": "Top left",
      +    "tr": "Top right"
      +  }
      +}
    • removedInput schema / properties / watermarkTile
      Removed value: -{
      -  "default": false,
      -  "description": "NOT available here — true returns a clear error (the flatten tile path is broken in the pinned engine; run pdf_watermark, which tiles, before flattening).",
      -  "type": "boolean"
      -}
  5. First observed

TDQS

A4/5.0
Behavior3/5

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

Annotations already provide readOnlyHint=false and destructiveHint=false, so the operation is understood as a non-read-only transformation. The description adds useful behavioral context about the ZIP output and per-file error entries. It does not mention that flattening can destroy signatures, but the schema's signatureMode parameter covers that explicitly.

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?

The description is a single, front-loaded sentence with no filler. It communicates the core action, batch limit, and return format efficiently. The category tag is minor and does not detract from clarity.

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?

Given the very rich input schema and annotations, the description is complete enough for an agent to select and invoke the tool. It covers purpose, batch limit, output format, and error handling. It could explicitly route single-file cases to pdf_flatten, but that is a minor omission rather than a functional gap.

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 fully documents all 20 parameters. The description adds no parameter-level detail beyond 'same flatten configuration', which is appropriate but not additive. Baseline 3 applies because the schema carries the semantic burden.

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 states a specific verb and resource ('Flatten PDFs'), the batch scope ('up to 20 PDFs in one request'), and the output format ('Returns a ZIP'). It clearly distinguishes itself from the sibling pdf_flatten by emphasizing the batch nature.

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?

The description clearly implies batch usage ('up to 20 PDFs in one request') and that the same configuration is applied across files. It does not explicitly name pdf_flatten as the single-file alternative, but the sibling name and the word 'Batch' make the intended use case clear.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources