Skip to main content
Glama

detect_document

Detect the four corners of a document in an image to enable cropping, deskewing, or straightening before OCR.

Instructions

Detect the boundary of a document in a local image using Apple Vision (offline, no API key needed).

USE WHEN: The user has a photo of a piece of paper, a receipt, a card, an ID, or any rectangular document and wants the four corner points — typically as a hint for cropping, deskewing, or straightening the image before further OCR. DO NOT USE for: reading the document text (use ocr_image), classifying the image (use classify_image), or analyzing a PDF (PDFs are already rectangular pages).

Returns: JSON with the four corner points of the detected document — topLeft, topRight, bottomLeft, bottomRight — each as { x, y } in 0–1 image coordinates, plus a confidence score. Returns { "detected": false } if no document is found.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute or relative path to the image file
Behavior4/5

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

Discloses offline operation (Apple Vision, no API key), return format (corner points in 0-1 coordinates, confidence), and failure case (detected: false). No annotations provided, so description carries full burden; minor gap: no mention of supported image formats or error scenarios beyond missing document.

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?

Description is concise and well-structured with clear sections (USE WHEN, DO NOT USE, Returns). Every sentence adds value, no unnecessary text.

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

Completeness5/5

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

Given the tool's simplicity (single parameter, no output schema), the description fully covers purpose, usage, return values, and limitations. No output schema exists, so the description correctly explains the JSON return format.

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?

Input schema has one parameter 'path' with description. Schema coverage is 100%, so baseline 3. Description adds no extra detail about path format or constraints beyond what schema provides.

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?

Description clearly states the tool detects document boundaries in a local image and returns corner points. It specifies the resource (document in image) and verb (detect boundary), and distinguishes from siblings like ocr_image and classify_image.

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

Usage Guidelines5/5

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

Explicitly provides 'USE WHEN' with examples (photo of paper, receipt) and 'DO NOT USE for' with alternatives (ocr_image, classify_image, analyze PDF). This gives clear context for tool selection.

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/woladi/macos-vision-mcp'

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