Skip to main content
Glama
mlorentedev

pdf-modifier-mcp

modify_pdf_content

Find and replace text in PDF files while preserving original font styling. Supports regex, hyperlinks, and page ranges for targeted modifications.

Instructions

Find and replace text in a PDF while preserving font styles.

This tool performs text replacement by:

  1. Locating all occurrences of the search text

  2. Redacting the original text (white fill)

  3. Inserting the replacement text with matched styling

IMPORTANT BEHAVIORS:

  • Text is matched within individual text spans

  • Font style is approximated using Base 14 fonts (Helvetica, Times, Courier)

  • Replacement text should be similar length to avoid overlap

  • Multiple replacements can be specified in a single call

HYPERLINK SUPPORT:

  • Append "|URL" to create a clickable link: "Click Here|https://example.com"

  • Use "|void(0)" to neutralize existing links: "Product|void(0)"

REGEX SUPPORT:

  • Set use_regex=true to treat keys as regex patterns

  • Useful for matching dates, IDs, or variable content

  • Example: {"Order #\d+": "Order #REDACTED"}

PAGE RANGE:

  • Use pages="1-3" to process only pages 1 through 3 (1-indexed, inclusive)

  • Use pages="5" to process only page 5

  • Omit to process all pages

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
input_pathYesAbsolute path to the source PDF file.
output_pathYesAbsolute path where the modified PDF will be saved. Parent directory must exist.
replacementsYesDictionary mapping old text to new text. Keys are search strings (or regex if use_regex=true). Values are replacement strings (optionally with |URL).
use_regexNoIf true, treat replacement keys as regex patterns. Default is false for literal string matching.
passwordNoOptional password if the source PDF is encrypted.
pagesNoOptional page range, e.g. "1-3" or "5". Defaults to all pages.
max_file_sizeNoMaximum allowed input file size in bytes (default: 100 MB).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

No annotations provided, so description carries full burden. It discloses text matching within spans, font approximation using Base 14 fonts, replacement length concerns, and hyperlink/date features. Lacks mention of potential side effects like irreversibility or permission requirements.

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?

Well-structured with clear headings and bullet points. Each section serves a purpose without redundancy. Slightly lengthy but justified by the complexity of features (hyperlink, regex, page range).

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?

Covers main behaviors, edge cases (hyperlink, regex, password), and max file size. Output schema exists, so return value details are unnecessary. Could mention layout changes due to font approximation, but overall sufficiently comprehensive.

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 has 100% description coverage, but description adds significant value beyond schema: explains hyperlink syntax for replacements, regex format, page range formatting, and max_file_size default. Provides clear examples that schema alone does not.

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?

Description clearly states the tool finds and replaces text in a PDF while preserving font styles. It details the process (locate, redact, insert) and distinguishes from siblings like batch_modify_pdf_content or list_pdf_hyperlinks by focusing on single-file content modification.

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?

Provides clear usage sections for important behaviors, hyperlinks, regex, and page ranges. Implicitly distinguishes from batch_modify_pdf_content for multi-file tasks, but lacks explicit when-not-to-use guidance or direct sibling comparisons.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mlorentedev/pdf-modifier-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server