Skip to main content
Glama

Batch-edit a PDF template

pdf_batch
Idempotent

Apply the same edits to one template PDF once per record, producing one output document per record — a mail merge over an existing PDF. Returns a job_id: call pdf_job with it for the per-record results. To change text on one page only, set scope.pages; to pick one of several identical matches, use scope.after with nearby text or scope.occurrence. Use op: 'redact' when the text must be unrecoverable.

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": {
      "file": "<file>",
      "edits": "<edits>"
    },
    "name": "pdf_batch"
  }
}

Input Schema

NameRequiredDescriptionDefault
fileYesThe PDF: an absolute (or ~) local path, which this server uploads for you, an https:// URL the API fetches, or an `f_…` file id from an earlier call. Used as the template for every record.
editsYesThe edits applied to each record, with `{field}` placeholders filled from it.
optionsNo
recordsNoOne object per output document.
passwordNo
records_urlNoA CSV or JSONL file of records, instead of `records`.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • changedInput schema / properties / edits / items / properties / at / anyOf
      Previous value: -[
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "after": {
      -        "description": "Anchor text to insert after; the first occurrence on the page wins, and the style is inherited from it.",
      -        "type": [
      -          "string",
      -          "null"
      -        ]
      -      },
      -      "page": {
      -        "maximum": 9007199254740991,
      -        "minimum": 1,
      -        "type": "integer"
      -      },
      -      "placement": {
      -        "description": "With `after`: 'inline' writes one space past the anchor's right edge on its own baseline; 'below' writes at the anchor line's left edge, one leading down. (default: \"inline\")",
      -        "enum": [
      -          "inline",
      -          "below"
      -        ],
      -        "type": "string"
      -      },
      -      "units": {
      -        "description": "(default: \"pt\")",
      -        "enum": [
      -          "pt",
      -          "fraction"
      -        ],
      -        "type": "string"
      -      },
      -      "x": {
      -        "description": "Baseline origin x. Points from the page's left edge, or a fraction of the page width when units='fraction'.",
      -        "type": [
      -          "number",
      -          "null"
      -        ]
      -      },
      -      "y": {
      -        "description": "Baseline origin y: where the first line sits, measured from the page's TOP edge (PDF viewer convention, as every bbox and span origin in this API). A fraction of the page height when units='fraction'.",
      -        "type": [
      -          "number",
      -          "null"
      -        ]
      -      }
      -    },
      -    "required": [
      -      "page"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "additionalProperties": false,
      +    "properties": {
      +      "after": {
      +        "description": "Anchor text to insert after; the first occurrence on the page wins, and the style is inherited from it.",
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      },
      +      "over_text": {
      +        "description": "With x/y: write there even if the page already has text at that point. Off, an insert that would land on or run into existing text is refused (`occupied`), because a caller who cannot see the page would ruin the very line they meant to fix. On, for a position chosen on a rendered page -- a label dragged next to another -- the text is written as asked. (default: false)",
      +        "type": "boolean"
      +      },
      +      "page": {
      +        "maximum": 9007199254740991,
      +        "minimum": 1,
      +        "type": "integer"
      +      },
      +      "placement": {
      +        "description": "With `after`: 'inline' writes one space past the anchor's right edge on its own baseline; 'below' writes at the anchor line's left edge, one leading down. (default: \"inline\")",
      +        "enum": [
      +          "inline",
      +          "below"
      +        ],
      +        "type": "string"
      +      },
      +      "units": {
      +        "description": "(default: \"pt\")",
      +        "enum": [
      +          "pt",
      +          "fraction"
      +        ],
      +        "type": "string"
      +      },
      +      "x": {
      +        "description": "Baseline origin x. Points from the page's left edge, or a fraction of the page width when units='fraction'.",
      +        "type": [
      +          "number",
      +          "null"
      +        ]
      +      },
      +      "y": {
      +        "description": "Baseline origin y: where the first line sits, measured from the page's TOP edge (PDF viewer convention, as every bbox and span origin in this API). A fraction of the page height when units='fraction'.",
      +        "type": [
      +          "number",
      +          "null"
      +        ]
      +      }
      +    },
      +    "required": [
      +      "page"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • addedInput schema / properties / edits / items / properties / by
      Added value: +{
      +  "anyOf": [
      +    {
      +      "additionalProperties": false,
      +      "properties": {
      +        "dx": {
      +          "description": "(default: 0)",
      +          "type": "number"
      +        },
      +        "dy": {
      +          "description": "(default: 0)",
      +          "type": "number"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "description": "`move` only: the displacement. The phrase's own glyphs are drawn again that far away -- same font, size and weight -- and the rest of its line stays where it was."
      +}
    • changedInput schema / properties / edits / items / properties / op / enum
      Previous value: -[
      -  "replace",
      -  "delete",
      -  "redact",
      -  "insert",
      -  "form",
      -  "stamp",
      -  "remove_image"
      -]New value: +[
      +  "replace",
      +  "delete",
      +  "redact",
      +  "insert",
      +  "form",
      +  "stamp",
      +  "remove_image",
      +  "move"
      +]
  2. Changed1 schema field changed
    • changedInput schema / properties / edits / items / properties / op / enum
      Previous value: -[
      -  "replace",
      -  "delete",
      -  "redact",
      -  "insert",
      -  "form",
      -  "stamp"
      -]New value: +[
      +  "replace",
      +  "delete",
      +  "redact",
      +  "insert",
      +  "form",
      +  "stamp",
      +  "remove_image"
      +]
  3. Changed3 schema fields changed
    • addedInput schema / properties / edits / items / properties / box
      Added value: +{
      +  "anyOf": [
      +    {
      +      "additionalProperties": false,
      +      "properties": {
      +        "h": {
      +          "description": "Height in points.",
      +          "maximum": 14400,
      +          "type": "number"
      +        },
      +        "page": {
      +          "maximum": 9007199254740991,
      +          "minimum": 1,
      +          "type": "integer"
      +        },
      +        "w": {
      +          "description": "Width in points.",
      +          "maximum": 14400,
      +          "type": "number"
      +        },
      +        "x": {
      +          "description": "Left edge, points from the page's left.",
      +          "minimum": 0,
      +          "type": "number"
      +        },
      +        "y": {
      +          "description": "Top edge, points from the page's TOP.",
      +          "minimum": 0,
      +          "type": "number"
      +        }
      +      },
      +      "required": [
      +        "h",
      +        "page",
      +        "w",
      +        "x",
      +        "y"
      +      ],
      +      "type": "object"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ]
      +}
    • addedInput schema / properties / edits / items / properties / image
      Added value: +{
      +  "description": "The image to place: PNG, JPEG, GIF, BMP or WebP, as base64 (a `data:` URL is accepted). JPEG is stored as sent; PNG keeps its transparency.",
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
    • changedInput schema / properties / edits / items / properties / op / enum
      Previous value: -[
      -  "replace",
      -  "delete",
      -  "redact",
      -  "insert",
      -  "form"
      -]New value: +[
      +  "replace",
      +  "delete",
      +  "redact",
      +  "insert",
      +  "form",
      +  "stamp"
      +]
  4. Changed1 schema field changed
    • addedInput schema / properties / options / properties / webhook_url / description
      Added value: +"Called with POST when the job finishes: the body is the job's result (what GET /v1/jobs/{id} returns) plus `event` (job.done, job.failed, batch.done ...) and `job_id`, signed in `X-Signature` (hex HMAC-SHA256 of the raw body with the account's webhook secret). Non-2xx answers are retried after 1, 5 and 30 minutes. https only."
  5. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Beyond the annotations, the description discloses the asynchronous job model (returns a job_id, poll pdf_job) and warns that redact makes text unrecoverable, which is real behavioral context. It does not address whether the template file itself is modified or what the batch does on partial failure, both of which are non-obvious for a mutating batch tool with destructiveHint=false.

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?

Four sentences, front-loaded with the core operation and the mail-merge analogy, then the return/next-step contract, then targeted parameter hints. No restatement of the name or title and nothing padding the front of the description.

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?

For a 6-parameter tool with nested edits, an options block and no output schema, the description covers the essential contract: what is produced per record, how to retrieve results, and how to target edits safely. The remaining surface (output zip vs files, atomic/fail_fast, retain, webhook) is documented in the schema, so the gap is small but the description stops short of the batch-failure semantics an agent would want.

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 67%, and the description compensates by explaining the disambiguation parameters in prose: scope.pages for single-page edits, scope.after with nearby text or scope.occurrence to pick among identical matches, and op:'redact' for irrecoverable removal. It leaves the large options block and records/records_url entirely to the schema, which is acceptable given their inline 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 gives a specific verb, resource and scope: apply the same edits to one template PDF once per record, producing one output document per record, and names the concept ('mail merge over an existing PDF'). The 'once per record' batching clause implicitly separates it from the single-document pdf_edit sibling without needing to open either 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?

It clearly routes the agent after the call ('Returns a job_id: call pdf_job with it for the per-record results') and gives concrete when-to-use conditions for scope.pages, scope.after/scope.occurrence and op:'redact'. What's missing is an explicit exclusion — it never states when to use pdf_edit or pdf_preview instead of this tool, leaving that inference to the agent.

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.