Skip to content

MCP Tools Reference

Extract the complete structural content of a PDF document.

ParameterTypeRequiredDescription
input_pathstringYesAbsolute path to the PDF file
passwordstringNoPassword if the PDF is encrypted

Returns JSON with the full page hierarchy:

{
"success": true,
"file_path": "/path/to/document.pdf",
"total_pages": 2,
"pages": [
{
"page": 1,
"width": 612.0,
"height": 792.0,
"elements": [
{
"text": "Invoice #12345",
"bbox": [72.0, 72.0, 200.0, 84.0],
"origin": [72.0, 82.5],
"font": "Helvetica-Bold",
"size": 12.0,
"color": 0
}
]
}
]
}

Call this tool first to understand the document layout. The bbox and origin values help identify exact text positions, and font/size show what styling will be preserved during replacement.


Search for specific text terms and report their font properties.

ParameterTypeRequiredDescription
input_pathstringYesAbsolute path to the PDF file
termsstring[]YesList of text strings to search (1-50 terms)
passwordstringNoPassword if the PDF is encrypted
{
"success": true,
"file_path": "/path/to/document.pdf",
"terms_searched": ["Invoice", "Total"],
"matches": [
{
"page": 1,
"term": "Invoice",
"context": "Invoice #12345 - January 15, 2025",
"font": "Helvetica-Bold",
"size": 12.0,
"origin": [72.0, 82.5]
}
],
"total_matches": 1
}

Run this before modify_pdf_content to verify that target text exists and understand its font properties. The context field shows surrounding text to help disambiguate partial matches.


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

ParameterTypeRequiredDescription
input_pathstringYesAbsolute path to the source PDF
output_pathstringYesAbsolute path for the modified PDF
replacementsobjectYesDictionary mapping old text to new text
use_regexbooleanNoTreat keys as regex patterns (default: false)
passwordstringNoPassword if the PDF is encrypted
{
"success": true,
"input_path": "/path/to/input.pdf",
"output_path": "/path/to/output.pdf",
"replacements_made": 3,
"pages_modified": 2,
"warnings": []
}

Simple text replacement:

{"$99.99": "$149.99", "Draft": "Final"}

Regex patterns (with use_regex: true):

{"Order #\\d+": "Order #REDACTED", "\\d{2}/\\d{2}/\\d{4}": "01/01/2025"}

Hyperlink creation (append |URL):

{"Click Here": "Visit Site|https://example.com"}

Link neutralization (append |void(0)):

{"Product Name": "Product Name|void(0)"}
  • Text is matched within individual spans first, then a second pass matches across span boundaries within the same line
  • Font style is approximated using Base 14 fonts (Helvetica, Times, Courier)
  • Replacement text should be similar length to avoid visual overlap
  • Maximum 100 replacements per call

Extract all existing hyperlinks and clickable URIs from a PDF.

ParameterTypeRequiredDescription
input_pathstringYesAbsolute path to the PDF file
passwordstringNoPassword if the PDF is encrypted
{
"success": true,
"file_path": "/path/to/document.pdf",
"total_links": 2,
"links": [
{
"page": 1,
"uri": "https://example.com",
"bbox": [72.0, 100.0, 200.0, 112.0],
"text": "Visit our website"
}
]
}

Apply the same text replacements to multiple PDF files at once. Each file is processed independently — a failure in one file does not stop the rest.

ParameterTypeRequiredDescription
input_pathsstring[]YesList of absolute paths to input PDF files
output_dirstringYesDirectory where modified PDFs will be saved
replacementsobjectYesDictionary mapping old text to new text
use_regexbooleanNoTreat keys as regex patterns (default: false)
passwordstringNoPassword if PDFs are encrypted
{
"total_files": 3,
"successful": 2,
"failed": 1,
"results": [
{
"success": true,
"input_path": "/path/to/a.pdf",
"output_path": "/path/to/output/a.pdf",
"replacements_made": 5,
"pages_modified": 2,
"warnings": []
}
],
"errors": [
{"file": "/path/to/missing.pdf", "error": "PDF file not found: ..."}
]
}

Use this for bulk operations like redacting dates across a folder of invoices. Output files are written to output_dir using the same filename as the input.


All tools return structured JSON errors with typed codes:

CodeDescription
FILE_NOT_FOUNDPDF file does not exist or is not accessible
FILE_TOO_LARGEPDF exceeds the maximum allowed size (default 100 MB)
READ_ERRORFailed to read or parse PDF (may be corrupted)
WRITE_ERRORFailed to write output PDF
PASSWORD_ERRORPDF requires a password but none (or incorrect) was provided
INVALID_PATTERNRegex pattern is invalid
UNEXPECTED_ERRORUnhandled error (check logs)

Error response format:

{
"success": false,
"error": "PASSWORD_ERROR",
"message": "PDF is password protected. Please provide a password.",
"details": {}
}