Skip to main content
Glama

Add page numbers

add_page_numbers
Idempotent

Write page numbers or custom headers/footers onto selected or all PDF pages, placing searchable text at a chosen corner, and save the result as a new PDF.

Instructions

Writes page numbers, or a header/footer such as "Confidential - Page {n} of {total}", onto every page or the chosen pages of a PDF and saves the result as a new PDF. The text is placed at the chosen corner or edge, and stays real, searchable text. For a large diagonal stamp across the page, use add_watermark. The original is not changed, and an existing output file is only replaced with overwrite: true. Encrypted PDFs cannot be saved.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path of the PDF.
colorNoText colour (default dark grey), as #rrggbb.
pagesNoPages as 1-based numbers and ranges, e.g. "1-3,5". All pages when omitted; a page outside the document is an error.
startNoNumber of the first page (default 1).
formatNoText with {n} for the page number and {total} for the page count (default "{n}").
marginNoDistance from the page edge in points (default 24).
outputYesAbsolute path of the new PDF. If the file exists, the call fails unless overwrite is true.
passwordNoPassword, if the PDF is encrypted. Without it an encrypted PDF cannot be opened; with it, it can be read, but tools that write a new PDF cannot save it.
positionNoDefault bottom-center.
font_sizeNoDefault 10.
overwriteNoAllow replacing an existing file (default false).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv1.0.9
    • changedInput schema / properties / output / description
      Previous value: -"Absolute path of the PDF to write."New value: +"Absolute path of the new PDF. If the file exists, the call fails unless overwrite is true."
    • changedInput schema / properties / pages / description
      Previous value: -"Pages, e.g. \"1-3,5\" (1-based). All pages when omitted."New value: +"Pages as 1-based numbers and ranges, e.g. \"1-3,5\". All pages when omitted; a page outside the document is an error."
    • changedInput schema / properties / password / description
      Previous value: -"Password, if the PDF is encrypted."New value: +"Password, if the PDF is encrypted. Without it an encrypted PDF cannot be opened; with it, it can be read, but tools that write a new PDF cannot save it."
  2. Added

TDQS

A4.9/5.0
Behavior5/5

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

Goes well beyond the annotations (readOnlyHint=false, destructiveHint=false, idempotentHint=true): it discloses non-destructive-by-default behavior, the exact overwrite escape hatch, the encryption limitation, and that the added text remains real searchable text rather than a raster overlay. These are the traits an agent actually needs before invoking.

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 and output, then alternative, then safety constraints. No filler and no repetition of schema fields.

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?

With no output schema, the description supplies what would otherwise be missing: the result is a new PDF, the original is preserved, the text is searchable, and encryption blocks saving. An 11-parameter mutation tool is fully covered by description plus schema.

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 baseline is 3, but the description adds real value by demonstrating the format parameter with a concrete template ('Confidential - Page {n} of {total}') and clarifying placement ('chosen corner or edge'). It does not cover color, margin, font_size or page-range syntax, which the schema already handles.

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 ('write page numbers ... onto every page or chosen pages of a PDF and saves the result as a new PDF') and immediately distinguishes itself from add_watermark, the nearest sibling. An agent can tell what this produces 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 Guidelines5/5

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

Names the explicit alternative for a different need ('For a large diagonal stamp across the page, use add_watermark'), and states the conditions that gate the write: original untouched, existing output replaced only with overwrite: true, encrypted PDFs cannot be saved. Routing and preconditions are both covered.

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