Your onboarding or support agent receives a photo of a customer's ID. It needs two answers: is the document usable, and is the person old enough. It does not need the name, the birth date or the document number for that. Yet whatever a tool returns lands in the conversation, the model provider's request, your logs and saved transcripts.

This guide adds an ID verification tool to an AI agent through MCP that returns a verdict, not personal data, unless the task needs the identity. The tool is parse_id, part of our open source AI Engine MCP server, and it calls the ID Document OCR API. Sessions below ran in Claude Code on 4 December 2026 on public specimens.

Return what the decision needs

  • detail="verdict" (default): next_step, document type, country, is_expired, age_18_or_over, fields checked by the MRZ, anything missing. No name, no birth date, no document number.
  • detail="identity": adds names, dates, nationality and sex, for tasks like filling a form. The document number is masked except its last 4 characters.
  • The age is computed inside the tool against min_age (18 by default), so the birth date does not have to enter the conversation.

Install

Subscribe to the ID Document OCR API on RapidAPI (free plan available), then in 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: valid and adult, without the name

> A customer uploaded id_front.jpg and id_back.jpg to open an account. Is the ID valid and is the customer an adult? 

The full tool result the agent received:

{ "next_step": "accept", "document_type": "id_card", "country": "FRA", "sides": 2, "status": "ok", "is_expired": false, "age_18_or_over": true, "checked_by_mrz": [ "birth_date", "document_number", "expiry_date", "first_name", "last_name", "nationality", "sex" ], "missing_critical_fields": [], "mismatched_fields": [], "consistency_issues": [] } 
Yes on both counts. The ID passes the check and the holder is 18 or older. I asked only for the yes/no result, so no personal details (name, date of birth, ID number) came into this conversation. If you need them to fill in the account form, I can run it again and ask for them. 

The agent never opened the images and never saw the name, and still answered completely.

Session 2: an expired passport

> Same check for passport.jpg, a new customer: can we open the account? 
{ "next_step": "ask for a document that is not expired", "document_type": "passport", "country": "KOR", "sides": 1, "status": "ok", "is_expired": true, "age_18_or_over": true, "checked_by_mrz": [ "birth_date", "document_number", "expiry_date", "first_name", "last_name", "nationality", "sex" ], "missing_critical_fields": [], "mismatched_fields": [], "consistency_issues": [] } 
Not yet. The passport is expired, so ask the customer for a document that is still valid. I ran the check without personal details, so I didn't see the name, birth date or document number. If you need them, for example to fill in the account form, I can run it again with the identity details turned on. 

next_step folds verdict, expiry and age into one instruction, so the agent does not have to combine them.

Session 3: filling a form needs the identity

> Fill form.json with the customer's details from id_front.jpg and id_back.jpg. 

The agent chose detail="identity" by itself. The identity part of the result:

{ "fields": { "last_name": { "value": "MARTIN", "status": "mrz_confirmed" }, "first_name": { "value": "MAELYS GAELLE MARIE", "status": "mrz_confirmed" }, "birth_date": { "value": "1990-07-13", "status": "mrz_confirmed" }, "expiry_date": { "value": "2030-02-11", "status": "mrz_confirmed" }, "nationality": { "value": "FRA", "status": "mrz_confirmed" }, "sex": { "value": "F", "status": "mrz_confirmed" }, "document_number": { "value": "*****PFW4", "status": "mrz_confirmed" } } } 

Even here the document number arrived as *****PFW4. If a form needs the full number, read it in backend code, not through the chat.

Two checks with detail verdict return no personal data; filling a form with detail identity returns names and dates with the number masked

Design choices worth copying

  • Private by default, explicit to open: detail="identity" shows up in the tool call, so the transcript records when personal data was requested.
  • Compute inside, return the answer: age_18_or_over instead of the birth date.
  • Never return what no task needs: personal numbers and addresses are not returned at any level.
  • The docstring is the contract: it tells the model the output enters the conversation and when to ask for the identity.

The full tool code, a test client and production tips are in the original article: ID Verification MCP Tool on ai-engine.net. For the face step of remote onboarding, see the selfie to ID verification guide.

Next step

Get a key on the ID Document OCR API page, add the server with the command above and ask your assistant to check the French ID card specimen.