How it works
How an AI agent looks up order status safely
By the RoutMe team. Last updated .
An AI agent looks up order status safely by first verifying that the person asking owns the order, then calling a narrow read-only tool that returns only the fields needed to answer, and logging the call. The agent never holds write access or a general database connection, and it hands off when the lookup fails.
The risk to design against
Order data contains names, addresses and phone numbers. A support chat on a public site can be asked about any order number by anyone. If the tool returns details for any number a visitor types, you have built an order lookup service for strangers. Safety comes from the tool and the surrounding flow, not from asking the model to be careful.
Step 1: verify before reading
Ask for the order number plus a second detail, then require both inside the tool. The tool should refuse unless they match the same order. Do the matching on your server. Do not return the order and let the model decide whether to reveal it.
On WhatsApp, the sender's phone number is a stronger signal than anything typed, since the message arrives from that number. On a website, the visitor is anonymous unless they sign in, so rely on the second detail. Shopify's Customer Account API authenticates the buyer with OAuth 2.0 and exposes the signed-in customer's own orders, which suits a signed-in storefront. RoutMe's details form collects unverified details and does not verify a visitor, so verification belongs in your tool.
Step 2: a narrow read-only tool
Define one tool, for example get_order_status(order_number, email). It performs a read, returns one record, and has no side effects. In MCP the server marks it with the readOnlyHint annotation. RoutMe's chat assistant is only offered tools the server marks read-only. Since the MCP specification says clients must treat annotations as untrusted unless the server is trusted, the real guarantee is that you wrote the tool and its credentials cannot write.
On Shopify, that means a custom app token with only the read scopes you need. The read_orders scope covers orders from the last 60 days, and read_all_orders extends beyond that, per Shopify's documentation.
Step 3: return the minimum
| Return | Do not return |
|---|---|
| Order number, status, carrier, tracking link, estimated delivery | Full address, payment details, other orders |
| Item names and quantities | Customer notes, internal tags |
| A clear "not found or does not match" message | Hints about which of the two details failed |
A generic failure message prevents a visitor from probing which order numbers exist.
Step 4: show the answer well
The assistant writes the reply from the result and can render an order status card using the A2UI catalog. See AG-UI and A2UI.
Step 5: log and hand off
Every tool call should be logged with its arguments and result so your team can review what the assistant saw. If verification fails twice, or the carrier data is missing, the assistant should stop and pass the conversation to a person. The agent should say it cannot confirm, rather than estimate. Details in human handoff best practices.
Putting it together on a store
- Run an MCP server that calls your platform's API with a read-only credential. Platform notes: Shopify, WooCommerce, BigCommerce.
- Register it in RoutMe and test the connection.
- Add your shipping policy as a knowledge source.
- Try wrong numbers, wrong emails and odd phrasing before publishing.
Testing the lookup before launch
Treat the lookup like any feature that touches personal data and test it adversarially. Try an order number that exists with the wrong email, a number that does not exist, a number with extra characters, and a message that includes two order numbers. Try asking for "all my orders" and "the last order from this phone number" and confirm the tool refuses what it was not built to do. Check the logs after each attempt to see exactly what the assistant sent and what came back. Finally, ask a colleague who has never seen the system to try to extract another customer's details in five minutes. Anything they find is a design gap to close before real customers arrive.
Sources
Explore the product: RoutMe for Shopify, solutions and the documentation.