Skip to main content
Glama

Add text, images, a signature or a barcode/QR code to a PDF

pdf_edit
DestructiveIdempotent

Stamp text, images, or barcodes at exact positions on selected pages of an existing PDF, using point coordinates to annotate or brand documents without altering the source.

Instructions

Stamp text and images (logos, signature images, photos) onto specific pages of an existing PDF at exact positions. Coordinates are PDF points measured from the bottom-left corner of the page as the viewer sees it (1 inch = 72 pt; US Letter is 612 x 792), so stamps land upright on any page size or rotation. Text uses standard fonts (WinAnsi characters only: CJK and emoji fail with unsupported_characters) and can wrap to max_width. Images are PNG or JPEG, up to 2 MB each and 10 distinct images per call (the PDF and all images together must stay under 4.5 MB), given as a local path, an https:// URL or a data:image/png;base64,... URI. Barcodes (QR, Data Matrix, PDF417, Aztec, Code 128, Code 39, EAN-13/8, UPC-A, ITF-14, Interleaved 2 of 5, GS1-128) are generated from a value and drawn as vector paths, so they scan at any print size (up to 25 per call). Use pdf_fill for fillable form fields and pdf_watermark for a diagonal stamp on every page. Returns the result written to output_path, or inline as an application/pdf resource when output_path is omitted (results over 7 MB are never returned inline: pass output_path); an existing file at output_path is overwritten. The source is never modified.

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>",
      "items": "<items>"
    },
    "name": "pdf_edit"
  }
}

Input Schema

NameRequiredDescriptionDefault
itemsYesStamps to draw, in order (later items draw on top).
passwordNoPassword to open the input, only needed for a user-password PDF (owner-locked files with an empty user password open without it).
pdf_pathYesPDF 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.
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. Omit when running remotely: the PDF is then 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. Addedv0.5.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations declare destructiveHint=true and the description explains why in concrete terms: 'an existing file at output_path is overwritten' while 'The source is never modified', so the agent knows exactly what is at risk. It also discloses hard limits (2 MB per image, 10 distinct images, 25 barcodes, 4.5 MB total, 100 items), the WinAnsi encoding failure mode with its error token, and the 7 MB inline-return ceiling — none of which the annotations convey.

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?

It is front-loaded with purpose and coordinates before the constraint catalogue, and virtually every clause carries operative information. It is a single dense block, however, and the limits could be more scannable as structured fragments rather than one long paragraph.

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 multi-mode stamping tool with nested item types, the definition covers positioning model, per-type inputs, size limits, encoding limits, failure modes, alternatives, and output behavior. An output schema exists, yet the return-path explanation (written to output_path vs inline application/pdf resource) adds useful operational detail rather than redundancy.

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 description coverage is 100%, so the baseline is 3, but the description adds cross-cutting meaning the schema cannot: the coordinate frame (points from the bottom-left as the viewer sees it, 72 pt per inch, US Letter 612x792) and that stamps land upright regardless of page size or rotation. It also explains aggregate constraints across items (distinct image count and combined byte budget) and that barcodes are drawn as vector paths, which the per-field schema entries do not state.

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 opens with a specific verb and resource: 'Stamp text and images ... onto specific pages of an existing PDF at exact positions', and the barcode sentence extends the scope precisely. It distinguishes itself from siblings by naming pdf_fill and pdf_watermark with their respective use cases.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit routing is given: 'Use pdf_fill for fillable form fields and pdf_watermark for a diagonal stamp on every page', which tells the agent exactly when to pick an alternative. It also gives the inline-vs-output_path decision rule ('results over 7 MB are never returned inline: pass output_path'), so the calling context is fully specified.

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