Tools · Files and code

pdf

Read-only

Extract text, per-page content, or metadata from a PDF file (local or URL).

When to use: Use to extract text or metadata from a PDF — contracts, research papers, reports, invoices. Supports local paths and http(s) URLs.

Example

Run for real by scripts/tool-examples.py in a small demo project, with Haiku 5.5 where the tool calls a model. The output is exactly what the tool returned, in 0.1s.

The call

tool call
{
  "tool": "pdf",
  "arguments": {
    "action": "extract_text",
    "source": "contract.pdf",
    "max_chars": 800
  }
}

Real output

Master Subscription Agreement
Between: Acme Inc. ("Vendor") and Northwind Cloud Ltd. ("Customer")
Effective date: 2026-04-01
Term: 12 months, auto-renewing
MRR: $1,999.00 USD — billed monthly in advance
Invoice cadence: 1st of each month, Net 15
Payment method: ACH (primary), card (fallback)
Early-termination fee: 3 months MRR
Total contract value (year 1): $23,988.00 USD

Parameters

NameTypeDescription
action*stringWhat to do with the PDF: extract_text, extract_pages, metadata, or page_count.extract_pagesextract_textmetadatapage_count
source*stringLocal file path or http(s):// URL to the PDF.
pagesstringPage range, e.g. '1-3,5,7-9' or '1,3,5'. Empty → all pages. Out-of-range → clamped.
max_charsnumberMax characters for extract_text (default 50000). Output is truncated with a marker when hit.

* required

Read, search and edit the project; run commands, code and git.