Skip to main content
Glama

Merge PDFs

merge_pdfs
Idempotent

Concatenate 2–50 base64-encoded PDFs into one PDF in order; optionally encrypt the output.

Instructions

Concatenate 2–50 PDFs (pdfsBase64[]) into one fresh, self-contained document. Page-tree rebuild: signatures and AcroForm are dropped, XMP (and thus a PDF/A claim) does not survive — re-declare PDF/A on the generating tools; page boxes and /UserUnit do survive; URI links kept unless dropAnnotations:true. Encrypted sources open with one password (PASSWORD_REQUIRED / PASSWORD_INVALID); output unencrypted unless encrypt. Guards: 256 MiB assembly (maxOutputSizeBytes), 50 MiB output (OUTPUT_TOO_LARGE).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
encryptNoRe-encrypt the output (Standard Security Handler; AES-128 default or AES-256; RC4 never emitted).
passwordNoPassword applied to every encrypted source (pdfnative v1.6.0). Sources with an empty user password open without it. The merged output is unencrypted unless `encrypt` is set.
outputModeNo'base64' (default) returns the PDF inline; 'file' writes it inside the PDFNATIVE_MCP_OUTPUT_DIR sandbox (SECURITY_VIOLATION when the sandbox is not configured).base64
outputPathNoRequired when outputMode='file'. Relative path inside the sandbox; must end with .pdf (no absolute paths, no '..').
pdfsBase64YesBase64-encoded source PDFs to concatenate, in order. 2–50 documents. Signatures and AcroForms are dropped (a page-tree edit invalidates them); encrypted PDFs are rejected.
dropAnnotationsNoWhen true, drop ALL annotations. Default (false) keeps self-contained URI link annotations and drops cross-document/widget annotations.
maxOutputSizeBytesNoIn-memory assembly guard (pdfnative maxOutputSize): the merge throws before materialising an object graph larger than this. Defaults to 268435456 (256 MiB). Note the emitted PDF is separately capped at 50 MiB by the output layer.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeYes
summaryNoTool-specific summary, when produced.
filePathNoSandboxed absolute path (file mode).
sizeBytesYes
diagnosticsNoEngine diagnostics (when includeDiagnostics=true).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.6.2
    • changedOutput schema / properties / diagnostics / description
      Previous value: -"PDF/A diagnostics (when includeDiagnostics=true)."New value: +"Engine diagnostics (when includeDiagnostics=true)."
  2. Added
  3. Removedv1.6.0
  4. Addedv1.2.2

TDQS

A4.6/5.0
Behavior5/5

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

Far exceeds the annotation bar: it discloses what is destroyed (signatures, AcroForm, XMP/PDF-A claim), what survives (page boxes, /UserUnit, URI links), error codes (PASSWORD_REQUIRED, PASSWORD_INVALID, OUTPUT_TOO_LARGE, SECURITY_VIOLATION) and two distinct size guards. Annotations only say it is not read-only and is idempotent, so the description carries the real behavioral load.

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?

Two sentences, front-loaded with the core operation before the caveats. Dense but every clause (what survives, error codes, guards) earns its place; the inline error-code tokens make it slightly less scannable than an ideal definition.

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?

An output schema exists so return values need no explanation, and the description still covers encryption, annotation handling, sandboxed file output, and size limits — everything an agent needs to invoke this 7-parameter nested-object 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 coverage is 100%, so the baseline is 3, but the description adds genuine meaning: `password` applies to every encrypted source, output is unencrypted unless `encrypt` is set, and it explains the layering of `maxOutputSizeBytes` (256 MiB assembly) against the separate 50 MiB output cap. Still, per-parameter syntax largely lives in the schema.

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?

Opens with a specific verb and resource plus scope: 'Concatenate 2–50 PDFs into one fresh, self-contained document.' That cleanly separates it from siblings like split_pdf, extract_pages, or validate_pdf.

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?

Gives clear operating conditions (encrypted sources need a password, output is unencrypted unless `encrypt`, page-tree rebuild side effects) and even routes PDF/A re-declaration to the generating tools. It stops short of naming a specific alternative sibling or stating explicit when-not-to-use cases.

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