docs/tools/pdf.md
pdf analyzes one or more PDF documents and returns text.
Quick behavior:
pdf) or multi (pdfs) input, max 10 PDFs per call.The tool is only registered when OpenClaw can resolve a PDF-capable model config for the agent:
agents.defaults.pdfModelagents.defaults.imageModelIf no usable model can be resolved, the pdf tool is not exposed.
Availability notes:
provider/model only counts if
OpenClaw can actually authenticate that provider for the agent.Input notes:
pdf and pdfs are merged and deduplicated before loading.pages is parsed as 1-based page numbers, deduped, sorted, and clamped to the configured max pages.maxBytesMb defaults to agents.defaults.pdfMaxBytesMb or 10.~ expansion)file:// URLhttp:// and https:// URLmedia://inbound/<id>Reference notes:
ftp://) are rejected with unsupported_pdf_reference.http(s) URLs are rejected.Native mode is used for provider anthropic and google.
The tool sends raw PDF bytes directly to provider APIs.
Native mode limits:
pages is not supported. If set, the tool returns an error.Fallback mode is used for non-native providers.
Flow:
agents.defaults.pdfMaxPages, default 20).200 chars, render selected pages to PNG images and include them.Fallback details:
4,000,000.document-extract plugin. The plugin owns
pdfjs-dist; @napi-rs/canvas is used only when image rendering fallback is
available.{
agents: {
defaults: {
pdfModel: {
primary: "anthropic/claude-opus-4-6",
fallbacks: ["openai/gpt-5.4-mini"],
},
pdfMaxBytesMb: 10,
pdfMaxPages: 20,
},
},
}
See Configuration Reference for full field details.
The tool returns text in content[0].text and structured metadata in details.
Common details fields:
model: resolved model ref (provider/model)native: true for native provider mode, false for fallbackattempts: fallback attempts that failed before successPath fields:
details.pdfdetails.pdfs[] with pdf entriesrewrittenFrompdf required: provide a path or URL to a PDF documentdetails.error = "too_many_pdfs"details.error = "unsupported_pdf_reference"pages: throws clear pages is not supported with native PDF providers errorSingle PDF:
{
"pdf": "/tmp/report.pdf",
"prompt": "Summarize this report in 5 bullets"
}
Multiple PDFs:
{
"pdfs": ["/tmp/q1.pdf", "/tmp/q2.pdf"],
"prompt": "Compare risks and timeline changes across both documents"
}
Page-filtered fallback model:
{
"pdf": "https://example.com/report.pdf",
"pages": "1-3,7",
"model": "openai/gpt-5.4-mini",
"prompt": "Extract only customer-impacting incidents"
}