Skip to main content
Glama

Fill PDF form

pdf_fill
DestructiveIdempotent

Fill AcroForm fields in a PDF and save or return the completed document without changing the source. Provide field names and string values to populate forms, including checkboxes and dropdowns.

Instructions

Fill form fields (AcroForm) in a PDF and save or return the filled PDF. Field names must exist in the PDF (pdf_inspect lists them). All values are strings; checkboxes take "true"/"false"; dropdown/radio/optionlist values must be one of the field's options; text values must respect the field's maxLength from pdf_inspect. The source PDF is never modified. Returns the filled PDF written to output_path, or inline as an application/pdf resource when output_path is omitted; an existing file at output_path is overwritten. Owner-locked PDFs (empty user password, common for government blanks) fill without a password; a user-password PDF needs the password parameter, otherwise it is rejected with encrypted_pdf. A rejected fill writes no file at all.

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": {
      "pdf_path": "<pdf_path>",
      "fields": "<fields>"
    },
    "name": "pdf_fill"
  }
}

Input Schema

NameRequiredDescriptionDefault
fieldsYesField name → string value (from pdf_inspect's fillTemplate)
flattenNoBake values into page content and drop the AcroForm so fields are no longer editable
passwordNoPassword to open the input, only needed for a user-password PDF (owner-locked files with an empty user password open without it).
pdf_pathYesTemplate PDF source: a path to a .pdf file inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:application/pdf;base64,… URI. A URL or data URI works when this server runs remotely (Smithery, hosted gateways), where local paths do not exist.
output_pathNoPath of a .pdf file to write the result to, inside the allowed directories (PDFOPS_ROOT, default the working directory); an existing file there is overwritten. Without it (as when running remotely) the PDF is returned inline as an application/pdf resource for the client to save.

Output Schema

NameRequiredDescriptionDefault
bytesYesSize of the produced PDF in bytes
output_pathNoAbsolute path written, when output_path was supplied
resource_uriNopdfops:// uri of the inline application/pdf resource, when output_path was omitted

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.6.0
    • changedInput schema / properties / output_path / description
      Previous value: -"Path of a .pdf file to write the result to, inside the allowed directories (PDFOPS_ROOT, default the working directory); an existing file there is overwritten. Omit when running remotely: the PDF is then returned inline as an application/pdf resource for the client to save."New value: +"Path of a .pdf file to write the result to, inside the allowed directories (PDFOPS_ROOT, default the working directory); an existing file there is overwritten. Without it (as when running remotely) the PDF is returned inline as an application/pdf resource for the client to save."
    • changedInput schema / properties / pdf_path / description
      Previous value: -"Template PDF source: a path to a .pdf file inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:application/pdf;base64,… URI. Use a URL or data URI when this server runs remotely (Smithery, hosted gateways) where local paths do not exist."New value: +"Template PDF source: a path to a .pdf file inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:application/pdf;base64,… URI. A URL or data URI works when this server runs remotely (Smithery, hosted gateways), where local paths do not exist."
  2. Changed7 schema fields changedv0.5.0
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / fields / properties
      Added value: +{}
    • changedInput schema / properties / output_path / description
      Previous value: -"Absolute path to write the result. Omit when running remotely: the PDF is then returned inline as an application/pdf resource for the client to save."New value: +"Path of a .pdf file to write the result to, inside the allowed directories (PDFOPS_ROOT, default the working directory); an existing file there is overwritten. Omit when running remotely: the PDF is then returned inline as an application/pdf resource for the client to save."
    • addedInput schema / properties / password
      Added value: +{
      +  "description": "Password to open the input, only needed for a user-password PDF (owner-locked files with an empty user password open without it).",
      +  "type": "string"
      +}
    • changedInput schema / properties / pdf_path / description
      Previous value: -"Template PDF source: an absolute file path, an https:// URL, or a data:application/pdf;base64,… URI. Use a URL or data URI when this server runs remotely (Smithery, hosted gateways) where local paths do not exist."New value: +"Template PDF source: a path to a .pdf file inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:application/pdf;base64,… URI. Use a URL or data URI when this server runs remotely (Smithery, hosted gateways) where local paths do not exist."
    • addedOutput schema / properties / bytes / maximum
      Added value: +9007199254740991
    • addedOutput schema / properties / bytes / minimum
      Added value: +-9007199254740991
  3. Changed4 schema fields changedv0.3.2
    • changedInput schema / properties / output_path / description
      Previous value: -"Absolute path to write the filled PDF"New value: +"Absolute path to write the result. Omit when running remotely: the PDF is then returned inline as an application/pdf resource for the client to save."
    • changedInput schema / properties / pdf_path / description
      Previous value: -"Absolute path to the template PDF"New value: +"Template PDF source: an absolute file path, an https:// URL, or a data:application/pdf;base64,… URI. Use a URL or data URI when this server runs remotely (Smithery, hosted gateways) where local paths do not exist."
    • changedInput schema / required
      Previous value: -[
      -  "pdf_path",
      -  "fields",
      -  "output_path"
      -]New value: +[
      +  "pdf_path",
      +  "fields"
      +]
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": false,
      +  "properties": {
      +    "bytes": {
      +      "description": "Size of the produced PDF in bytes",
      +      "type": "integer"
      +    },
      +    "output_path": {
      +      "description": "Absolute path written, when output_path was supplied",
      +      "type": "string"
      +    },
      +    "resource_uri": {
      +      "description": "pdfops:// uri of the inline application/pdf resource, when output_path was omitted",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "bytes"
      +  ],
      +  "type": "object"
      +}
  4. First observedv0.2.0

TDQS

A4.6/5.0
Behavior5/5

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

Substantially exceeds the annotations. Where annotations only flag destructiveHint=true, the description clarifies that the source PDF is never modified and the destructive act is limited to overwriting an existing output_path file. It further discloses that a rejected fill writes no file at all and names the encrypted_pdf error, so an agent can reason about failure side effects rather than guessing.

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?

Front-loaded with the core action and every sentence carries new information; nothing is filler. It is a single dense paragraph, so the value-semantics, output-mode, and password rules run together where bullets or line breaks would aid scanning, but the compression is deliberate.

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?

For a 5-parameter, nested-object, side-effecting tool, the description covers prerequisites, value typing, output destination, overwrite behavior, and password failure modes. An output schema exists, yet the return-path distinction (file at output_path vs inline application/pdf resource) is explained anyway, leaving no operational question open.

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 real constraints the schema does not: values are always strings, checkboxes take "true"/"false", dropdown/radio/optionlist values must come from the field's options, and text must respect maxLength. It also explains when password is actually needed, which the schema only gestures at.

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?

States a specific verb and resource ('Fill form fields (AcroForm) in a PDF') plus the two output modes (save or return), which separates it from field-creation siblings like pdf_add_fields and from general content editing via pdf_edit. The reader knows exactly what operation this performs without opening the schema.

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 concrete preconditions and routing: field names must already exist, and pdf_inspect is named as the tool that lists them and supplies maxLength/options. It also sets out the password path (owner-locked vs user-password vs rejected with encrypted_pdf). What's missing is an explicit 'use pdf_add_fields first if the field doesn't exist' statement, so it stops short of full when/when-not guidance.

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