Your agent has to work with scans: a case file, a signed contract, a pile of receipts. Recent models can look at a page image and read it, so why add an OCR tool? We ran the test on 6 December 2026, in Claude Code, on a 62-page scanned court opinion. Reading and answering questions works with or without a tool. The difference shows when the task needs to know where the words are on the page.

The tools are extract_text and extract_pdf_text, part of our open source AI Engine MCP server. They call the OCR Wizard API. The document is the 1890 opinion of the Supreme Court of California in Colton v. Stanford (public domain), with its old text layer removed so that it is images only.

What the two tools return

  • extract_pdf_text(pdf_path, first_page, last_page): the text of each page, 10 pages per call, and next_first_page when the file has more.
  • extract_text(image, include_words): the text of an image. With include_words=True, every word comes with four corner points in pixels.

Two words of page 51, as returned (611 x 1098 image):

{"text": "$", "box": [{"x": 321, "y": 137}, {"x": 330, "y": 137}, {"x": 330, "y": 155}, {"x": 321, "y": 155}]}, {"text": "175,000", "box": [{"x": 332, "y": 137}, {"x": 397, "y": 137}, {"x": 397, "y": 155}, {"x": 332, "y": 155}]} 

Install (Claude Code)

claude mcp add ai-engine -e RAPIDAPI_KEY=your_key -- \ uvx --from "git+https://github.com/ai-engine-dev/api-examples#subdirectory=mcp-server" ai-engine-mcp 

Session 1: questions on a 62-page scan

Asked for the filing date, the amount Mrs. Colton had been allowed to draw, and the decision with its judges, each with a PDF page number, the agent called extract_pdf_text 7 times and answered: January 2, 1890 (page 9), about $175,000 (page 51), judgment affirmed, opinion by Paterson, J., concurred in by McFarland, Sharpstein, Works and Beatty, C. J. (page 54). All right, and it kept the printed page number (43) apart from the PDF page (51).

Session 2: highlight every amount, with and without the tool

> page51.jpg is a scanned page from a court opinion. Find every dollar amount written with a $ sign on it. Then: 1. Save page51_marked.png: the same image with a semi-transparent yellow box over each amount. 2. Save boxes.json: a JSON list with one [x0, y0, x1, y1] box per amount, in pixels of the original image. 

Four headless Claude Code runs (Claude Sonnet 5.5), two without the MCP server and two with it. Both could read and write files and run Python with Pillow, nothing else. Each box was measured against the true position of its amount.

Without the tool With extract_text
Amounts found 6/6, 6/6 6/6, 6/6
Worst amount covered 80%, 93% 100%, 100%
Agent steps 24, 31 12, 14
Time 52 s, 63 s 23 s, 38 s
Output tokens 5,746, 7,926 2,387, 3,605

The model found all six amounts by itself. Without the tool it placed the boxes by drawing grids and crops and looking again; its box on $7,000 still left a fifth of the amount outside. With the tool: one extract_text call, each "$" merged with the number after it, boxes drawn. The run summaries put the cost of the tool runs about 35% lower.

Page 51 highlighted by two agent runs: boxes placed by eye on the left, boxes from OCR word positions on the right

For a highlight, 80% is readable. For redaction it is not: the uncovered part of a number is still on the page. Word positions give the same boxes on every run.

The tool code, the drawing code the agent wrote and production tips are in the original article: OCR MCP Server on ai-engine.net.

Next step

Get a key on the OCR Wizard API page, add the server and ask your assistant to mark something on one of your scans. In plain Python, the RAG on scanned PDFs tutorial answers questions with page citations and highlights the quote on the page.