Skip to main content
Glama

ocr_file

Extract text from local image or PDF files using the OCR.space API, with support for multiple formats, languages, and output as text or JSON.

Instructions

Extract text from a local image or PDF file using OCR.space API. Supports PNG, JPG, GIF, BMP, TIFF, PDF. Free tier: max 1 MB. PRO tier: max 5 MB (EU endpoint for GDPR). Optionally saves result to txt or json file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tierNoAPI tier: 'free' (1MB limit, US servers) or 'pro' (5MB limit, EU/GDPR)free
scaleNoUpscale low-resolution images for better OCR
is_tableNoOptimize for table-like structures
languageNoOCR language code (e.g., 'eng', 'ger', 'fre'). Use 'auto' with Engine 2.eng
file_pathYesPath to the image or PDF file to OCR
ocr_engineNoEngine 1: Faster, Asian languages. Engine 2: Auto-detect, better accuracy.
output_pathNoOptional path to save extracted text (.txt) or full result (.json)
output_formatNoOutput format: 'txt' (text only) or 'json' (full API response)txt
detect_orientationNoAuto-rotate image based on detected text orientation
is_overlay_requiredNoInclude word coordinates/bounding boxes in response
is_create_searchable_pdfNoGenerate a searchable PDF (URL valid for 1 hour)
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the burden of behavioral disclosure. It adds valuable context: tier-based file size limits (1MB free, 5MB pro), EU endpoint for GDPR, and optional saving to txt/json. However, it does not explicitly state that the file is uploaded to a third-party API or describe return behavior when no output_path is given.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is three sentences with no fluff. It front-loads the primary action and packs in essential constraints (formats, size limits, GDPR, optional output) efficiently.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complex 11-parameter schema and no output schema, the description covers the core workflow (local input, API, optional saving) well. It misses an explicit statement about what the function returns when no output_path is provided, but 'Extract text' implies the text is returned, so the gap is minor.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so each parameter already has detailed descriptions (e.g., tier explains 1MB/5MB limits, output_path explains saving). The tool description adds only supported file formats, which is marginal. Baseline 3 is appropriate since the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Extract text from a local image or PDF file using OCR.space API', specifying the action, resource, and method. It also lists supported formats, making it distinct from sibling tools like ocr_url which handles URLs.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context that this tool is for local files, distinguishing it from URL-based tools. However, it does not explicitly name alternative tools (e.g., 'use ocr_url for remote files') or specify when not to use it, so it stops short of full guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/agentic-ai-forge/ocr-space-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server