check_document
Analyze document images to detect scam indicators by extracting entities and verifying them against government databases. Upload photos of suspicious letters, notices, or invoices for risk assessment.
Instructions
Analyze a document image for scam indicators. Upload a photo of a suspicious letter, court notice, receipt, invoice, or other document. Uses vision AI to extract entities (addresses, officials, citations, phone numbers) and verifies them against government databases. Returns risk score, verdict, red flags, and entity verification results.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| image_url | No | URL of the document image to analyze (provide either image_url or image_base64) | |
| image_base64 | No | Base64-encoded image data (provide either image_url or image_base64). Include the data URI prefix (e.g. data:image/jpeg;base64,...) or raw base64. |
Implementation Reference
- src/index.ts:255-278 (handler)The `check_document` tool is defined and registered using `server.tool`. It handles image document analysis by resolving the input image (either URL or Base64) and sending it via a multipart request to the `/api/v1/document/analyze` endpoint.
server.tool( 'check_document', 'Analyze a document image for scam indicators. Upload a photo of a suspicious letter, court notice, receipt, invoice, or other document. Uses vision AI to extract entities (addresses, officials, citations, phone numbers) and verifies them against government databases. Returns risk score, verdict, red flags, and entity verification results.', { image_url: z.string().optional().describe('URL of the document image to analyze (provide either image_url or image_base64)'), image_base64: z.string().optional().describe('Base64-encoded image data (provide either image_url or image_base64). Include the data URI prefix (e.g. data:image/jpeg;base64,...) or raw base64.'), }, { title: 'Analyze Document', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true, }, async ({ image_url, image_base64 }) => { try { const { buffer, mimeType, fileName } = await resolveImage(image_url, image_base64); const data = await apiMultipart('/api/v1/document/analyze', buffer, mimeType, fileName); return jsonResult(data); } catch (err) { return errorResult(err instanceof Error ? err.message : 'Document analysis failed'); } }, );