Tools · Files and code
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": "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 USDParameters
| Name | Type | Description |
|---|---|---|
| action* | string | What to do with the PDF: extract_text, extract_pages, metadata, or page_count.extract_pagesextract_textmetadatapage_count |
| source* | string | Local file path or http(s):// URL to the PDF. |
| pages | string | Page range, e.g. '1-3,5,7-9' or '1,3,5'. Empty → all pages. Out-of-range → clamped. |
| max_chars | number | Max characters for extract_text (default 50000). Output is truncated with a marker when hit. |
* required
More in Files and code
Read, search and edit the project; run commands, code and git.