ocr_pdf
Call this when a PDF's text cannot be extracted, selected, or searched -- typically a scanned document or a photo of a page saved as PDF. It runs OCR and returns a new PDF with a real, selectable text layer; the original file is not modified. Do NOT use this to convert a PDF to Word or Excel -- pdf_to_word already runs OCR internally on scanned pages, so call ocr_pdf only when you need the output to stay a PDF (e.g. to make it searchable, or before another PDF-only tool). If the PDF already has a usable text layer, OCR is skipped automatically, ocrApplied is returned false, and message explains that no OCR was needed -- relay that message to the user rather than assuming OCR ran. Pass forceOcr: true to force a full re-recognition pass anyway (useful if the existing text layer is garbled). Supports 15 languages in a single pass. Use list_files or upload_from_url to obtain the fileId first.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"fileId": "<fileId>"
},
"name": "ocr_pdf"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fileId | Yes | The ID of the PDF file to OCR | |
| forceOcr | No | Force a full OCR re-recognition pass even if the PDF already appears to have a text layer. Defaults to false. | |
| language | No | Primary language of the document text. Defaults to eng. | |
| idempotencyKey | No | Optional unique key (UUID) for this operation. If provided and the same key is received again within 5 minutes, the cached result is returned instead of re-executing the operation. Generate a fresh UUID per operation intent; reuse it only on retry. |