Skip to main content
Glama

Add page numbers to PDF

pdf_page_numbers
DestructiveIdempotent

Add page numbers to PDFs with a custom format, position, font size, page range, and starting number; write to a new file or return the PDF inline without modifying the source.

Instructions

Print page numbers on a PDF using a format template with {n} (page number) and {total} (page count), e.g. "Page {n} of {total}". Default is "{n} / {total}" at bottom-center, 10 pt. Numbers sit upright for any page size or rotation. Standard Helvetica only (WinAnsi characters). Page i always shows start+i-1 even when pages selects only some pages. 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>"
    },
    "name": "pdf_page_numbers"
  }
}

Input Schema

NameRequiredDescriptionDefault
sizeNoFont size in points, default 10
pagesNo1-based page spec such as "1-3,5"; default all pages
startNoNumber shown on page 1, default 1
formatNoTemplate with {n} and {total}, default "{n} / {total}"
marginNoDistance in points from the page edge, default 24
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.
positionNoDefault bottom-center
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.4/5.0
Behavior5/5

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

Annotations already flag this as destructive and non-read-only, and the description adds exactly the context that matters: 'The source is never modified', an existing file at output_path is overwritten, and results over 7 MB are never returned inline. It also discloses two non-obvious rendering constraints (Helvetica/WinAnsi only, numbers stay upright under any page size or rotation) that an agent could not guess from the schema.

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 behavior and the format template before defaults, return behavior, and edge cases. It is dense but every clause carries information; the one weak spot is that the return-path and inline-size caveat is buried mid-paragraph rather than given its own sentence.

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 9-parameter mutating tool with an output schema, this covers what the schema and annotations cannot: which file is at risk, the inline size ceiling, the font/encoding limitation, and the numbering offset under page filtering. An agent can call it correctly without further documentation.

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; the description goes beyond it by documenting the default template and 10 pt size inline and, more importantly, by clarifying that page i shows start+i-1 even when pages selects only a subset — a semantics point the schema does not state. The remaining parameters (margin, position, password) are left entirely to 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?

States a specific verb and resource ('Print page numbers on a PDF') and immediately pins down the mechanism (format template with {n}/{total}), which distinguishes it from the sibling stamping tool pdf_watermark and from pdf_edit.

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

Usage Guidelines3/5

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

The description explains defaults and the inline-vs-file choice ('pass output_path' above 7 MB) and notes the password requirement, which is useful context. It never states when to prefer this over alternatives such as pdf_watermark, nor what conditions make the tool inappropriate, so usage must be inferred from the name.

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