Skip to main content
Glama

Edit a PDF

pdf_edit
Idempotent

Edit an existing PDF in place: replace, delete, redact or insert text, fill form fields, stamp an image (a signature, a chop) into a box or remove one, keeping the original layout, fonts and everything you did not point at. edits[] is taken exactly as the API takes it (op, scope, match, fit), and the result carries up to 3 before/after previews of the pages that changed. 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_edit"
  }
}

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.
editsYesThe edits to apply, in order, exactly as `POST /v1/edit` takes them.
optionsNo
passwordNoThe document open password, when it has one.
output_pathNoWhere to write the edited PDF (stdio mode only). Default: `<name>.edited.pdf` next to the input, or `<name>.edited.2.pdf`, `.3.pdf`, ... when that exists; an earlier result is never overwritten.

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. Changed2 schema fields 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."
    • changedInput schema / properties / output_path / description
      Previous value: -"Where to write the edited PDF (stdio mode only). Default: `<name>.edited.pdf` next to the input."New value: +"Where to write the edited PDF (stdio mode only). Default: `<name>.edited.pdf` next to the input, or `<name>.edited.2.pdf`, `.3.pdf`, ... when that exists; an earlier result is never overwritten."
  5. First observed

TDQS

A3.5/5.0
Behavior1/5

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

The description adds useful behavior beyond annotations: preserved layout/fonts, up to three before/after previews, exact API-shaped edits, and unrecoverable redaction. However, it explicitly supports delete, redact, remove_image, insert, and stamp, which conflicts with annotations destructiveHint=false and idempotentHint=true; repeated insert/stamp is not idempotent and delete/redact are destructive to document content.

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 purpose, then API-shape, result previews, and targeted usage tips; no filler. Dense but appropriate for a complex edit tool.

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 complex mutation tool with a rich nested schema and no output schema, the description covers purpose, main operations, preview behavior, and key scoping/redaction rules. It leaves many options (async, atomic, webhook, OCR, dry_run) and output_path/file-writing behavior to the schema, which is acceptable given 80% schema coverage but not fully complete.

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 80%, so the schema already carries most parameter meaning. The description adds valuable operational semantics for edits[] and scope (scope.pages, scope.after, scope.occurrence, op:'redact') and notes that edits[] is taken exactly as the API accepts it, going beyond the schema's field-level descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb and resource ('Edit an existing PDF in place') and enumerates the exact edit operations (replace, delete, redact, insert, form, stamp, remove_image, move), so an agent knows precisely what the tool does. It does not explicitly route to siblings such as pdf_batch or pdf_find, so it is clear but not fully sibling-differentiated.

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 concrete selection rules for key parameters: scope.pages for a single page, scope.after/scope.occurrence for duplicate matches, and op:'redact' when text must be unrecoverable. It does not state when to prefer this tool over pdf_batch, pdf_find, pdf_preview, or pdf_job, so alternatives remain unaddressed.

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.