AI Shopping Assistant: Catalog-to-Cart Demonstration
Short answer
This Agent Commerce Optimization demonstration runs a shopping assistant's tool layer in your browser over a synthetic 30-product outdoor-gear catalog. A scripted, deterministic planner (no LLM) calls six typed tools for search, product detail, fitment, inventory, policy, and cart drafting. It shows each JSON call, the facts it cites, and how it handles unknown models, stockouts, ambiguity, and policy exclusions.
Key takeaways
- The planner is scripted and deterministic. The tool contracts and guardrails are what's being demonstrated, not language understanding.
- Fitment is an exact table lookup. An unknown model is an error that leads to a clarifying question, never a guess.
- Stock comes only from check_inventory, and an out-of-stock variant produces in-stock alternatives that the shopper has to choose.
- Policy exclusions such as final sale and hazmat shipping are enforced inside the tools, not left to the planner's judgment.
- The assistant can only produce a cart draft with status requires_customer_confirmation. It cannot place an order.
- We ran 54 automated checks against the tool functions and scenarios in this session, and all passed.
Can I try an assistant that finds products and selects variants?
Yes. Pick a shopper task below, or type a request. Each task runs real tool functions against the synthetic catalog, and the planner branches on what they return. Expand any step to see its JSON input and output. The right-hand panel shows the outcome, the guardrail that shaped it, and every source fact the answer relied on.
Demonstration: synthetic data, not a client case study
This is a deterministic, scripted planner over typed tools. No LLM is called. Every tool call below really runs against a synthetic 30-product catalog in your browser, and the planner branches on the real results. It shows the tool contracts, data checks, and guardrails a production assistant needs, not conversational intelligence.Tool calls (8)
SHOPPERFind a replacement filter that fits my Clearwell X200 pitcher.
1
search_catalogokInput
{ "query": "filter cartridge", "category": "water-filter-cartridge" }Output
{ "hits": [ { "productId": "P01", "name": "Clearwell F-100 Standard Cartridge", "category": "water-filter-cartridge", "score": 4 }, { "productId": "P02", "name": "Clearwell F-150 Carbon+ Cartridge", "category": "water-filter-cartridge", "score": 4 }, { "productId": "P03", "name": "Clearwell F-200 Max Cartridge", "category": "water-filter-cartridge", "score": 4 }, { "productId": "P04", "name": "Clearwell F-90 Travel Cartridge", "category": "water-filter-cartridge", "score": 4 } ], "categories": [ "water-filter-cartridge" ] }2
check_compatibilityokInput
{ "productId": "P01", "model": "CW-X200" }Output
{ "productId": "P01", "model": "CW-X200", "status": "compatible", "modelName": "Clearwell X200 pitcher", "fitsModels": [ "CW-X200" ] }3
check_compatibilityokInput
{ "productId": "P02", "model": "CW-X200" }Output
{ "productId": "P02", "model": "CW-X200", "status": "incompatible", "modelName": "Clearwell X200 pitcher", "fitsModels": [ "CW-X200P", "CW-X300" ] }4
check_compatibilityokInput
{ "productId": "P03", "model": "CW-X200" }Output
{ "productId": "P03", "model": "CW-X200", "status": "incompatible", "modelName": "Clearwell X200 pitcher", "fitsModels": [ "CW-X300" ] }5
check_compatibilityokInput
{ "productId": "P04", "model": "CW-X200" }Output
{ "productId": "P04", "model": "CW-X200", "status": "incompatible", "modelName": "Clearwell X200 pitcher", "fitsModels": [ "CW-T10" ] }6
get_productokInput
{ "productId": "P01" }Output
{ "productId": "P01", "name": "Clearwell F-100 Standard Cartridge", "category": "water-filter-cartridge", "attributes": { "filter_life_liters": 150, "media": "activated carbon" }, "fits": [ "CW-X200" ], "policyTags": [], "variants": [ { "sku": "CW-F100-1", "options": { "pack": "1-pack" }, "price": 14.99 }, { "sku": "CW-F100-3", "options": { "pack": "3-pack" }, "price": 39.99 } ] }7
check_inventoryokInput
{ "sku": "CW-F100-1" }Output
{ "sku": "CW-F100-1", "productId": "P01", "options": { "pack": "1-pack" }, "available": 14, "inStock": true }8
prepare_cartokInput
{ "lines": [ { "sku": "CW-F100-1", "qty": 1 } ] }Output
{ "status": "requires_customer_confirmation", "lines": [ { "sku": "CW-F100-1", "name": "Clearwell F-100 Standard Cartridge", "qty": 1, "unitPrice": 14.99, "lineTotal": 14.99 } ], "rejected": [], "subtotal": 14.99, "currency": "USD", "notes": [ "Draft only. The customer must review and confirm; no order has been placed." ] }
Expand a step to see its JSON input and output.
Result
ASSISTANTThe Clearwell F-100 Standard Cartridge (1-pack, $14.99) is the only cartridge in the fitment table for the CW-X200, and it is in stock. I prepared a cart draft for you to review. Note: the X200 Pro (CW-X200P) is a different model and takes the F-150 instead; tell me if that's your pitcher.
Guardrail: Fitment is an exact table match; the cart is a draft that requires your confirmation.
Cart draft · status requires_customer_confirmation
| SKU | Qty | Total |
|---|---|---|
| CW-F100-1 | 1 | $14.99 |
Subtotal $14.99 (synthetic)
Source facts cited (9)
catalog/search-index4 products matched "filter cartridge" in water-filter-cartridge.fitment/P01Clearwell F-100 Standard Cartridge is listed for CW-X200; CW-X200 is listed.fitment/P02Clearwell F-150 Carbon+ Cartridge is listed for CW-X200P, CW-X300; CW-X200 is not listed.fitment/P03Clearwell F-200 Max Cartridge is listed for CW-X300; CW-X200 is not listed.fitment/P04Clearwell F-90 Travel Cartridge is listed for CW-T10; CW-X200 is not listed.catalog/P01/attributes/filter_life_litersClearwell F-100 Standard Cartridge: filter_life_liters = 150catalog/P01/attributes/mediaClearwell F-100 Standard Cartridge: media = activated carboninventory/CW-F100-1CW-F100-1 has 14 available (synthetic snapshot).policy/POL-CART-1The assistant may prepare a cart draft. The customer must review and confirm it; the assistant cannot place orders, apply payment, or substitute variants without consent.
How is the shopping assistant demo built?
It has three layers: a planner that decides which tools to call, a typed tool layer that is the only way to reach data, and the data itself (catalog, fitment table, inventory snapshot, policy records). Everything runs client-side, and the code lives in src/lib/demos/catalog-assistant/.
Shopper request (curated task or free text)
│
▼
┌────────────────────────────┐ free text → keyword rules → curated intent
│ Planner (DEMO: scripted, │ no match → fallback message, no guessing
│ deterministic, no LLM) │
└─────────────┬──────────────┘
│ typed tool calls (inputs validated, outputs typed)
▼
┌──────────────────────────────────────────────────────────────┐
│ Tool layer (src/lib/demos/catalog-assistant/tools.ts) │
│ search_catalog · get_product · check_compatibility │
│ check_inventory · get_policy · prepare_cart │
│ every result = { ok, data | error, facts[] } │
└───────┬───────────────┬────────────────┬─────────────────────┘
▼ ▼ ▼
Catalog + specs Fitment table Inventory + policies
(30 synthetic (13 synthetic (synthetic snapshot,
products) device models) 4 policy records)
│
▼
Outcome: answer | offer_alternative | clarify | escalate | blocked | cart_draft
+ cited facts (record pointers) + guardrail that applied
cart_draft → status requires_customer_confirmation → store's own checkoutEvery tool returns the same envelope: ok, then either data or a typed error, plus facts[]. Each fact is a record pointer such as inventory/RL-JKT-BLU-M or policy/POL-FS-1 with a one-line statement. The citation panel collects these facts, so every claim in an answer traces back to a record. In a real deployment, the pointers become product URLs, policy page anchors, or PIM record IDs.
What does the synthetic catalog contain?
- 30 products and 44 variants across water filters, batteries, apparel, footwear, stoves and fuel, tents and parts, and sleep gear.
- A fitment table of 13 device models. Two of them deliberately look alike: the F-100 cartridge fits the Clearwell X200 but not the X200 Pro.
- Variant matrices (color × size, size × width, length × zip side), with several combinations out of stock.
- Policy tags:
final_saleon clearance items,hazmat_ground_onlyon fuel canisters and batteries over 100 Wh. - Gaps on purpose: the stove has weight, output, and fuel type but no burn time, so the demo can show it refusing to invent a spec.
What tools does an AI shopping assistant need?
At a minimum, it needs separate read tools for discovery, detail, fitment, stock, and policy, plus one write-adjacent tool that drafts a cart but cannot complete a purchase. Keeping them separate lets each one enforce its own rule.
| Tool | Input | Output | Guarantee |
|---|---|---|---|
search_catalog | { query, category?, limit? } | { hits[], categories } | Read-only. Returns only catalog records and rejects an empty query. |
get_product | { productId } | { name, attributes, fits?, policyTags, variants[] } | Read-only. No stock in the response. The attributes are the only specs the assistant may state. |
check_compatibility | { productId, model } | { status, fitsModels } or UNKNOWN_MODEL / NOT_A_PART | Exact match against the fitment table after normalizing case and spaces. Never a fuzzy match. |
check_inventory | { sku } | { available, inStock, options } | The assistant's only source of stock. |
get_policy | { topic, productId? } | { policyId, text, appliesToProduct? } | Returns policy text verbatim with its id, so answers can cite it. |
prepare_cart | { lines[{ sku, qty }], shipTo? } | { status: requires_customer_confirmation, lines, rejected[], subtotal } | Revalidates stock, quantity, and shipping restrictions. Returns a draft only. |
Exposed through the Model Context Protocol (MCP), the open protocol that lets AI applications discover and call tools on a server, each tool becomes a definition with a JSON Schema inputSchema and, optionally, an outputSchema. MCP's tools specification (version 2026-07-28, checked on 2026-11-29) also separates protocol errors from tool execution errors. Execution errors are returned with isError: true so the model can correct itself. Our typed UNKNOWN_MODEL and INSUFFICIENT_STOCK errors map directly onto that. The MCP server guide for ecommerce covers the wider design.
{
"name": "check_compatibility",
"title": "Check part fitment",
"description": "Exact lookup of a part against the fitment table. Returns UNKNOWN_MODEL when the model is not in the table; never infers fit from similar names.",
"inputSchema": {
"type": "object",
"properties": {
"productId": { "type": "string" },
"model": { "type": "string", "description": "Device model key, e.g. CW-X200" }
},
"required": ["productId", "model"],
"additionalProperties": false
},
"outputSchema": {
"type": "object",
"properties": {
"status": { "enum": ["compatible", "incompatible"] },
"fitsModels": { "type": "array", "items": { "type": "string" } }
},
"required": ["status", "fitsModels"]
}
}
// Unknown model → a tool execution error the planner can act on:
// { "isError": true, "content": [{ "type": "text", "text": "UNKNOWN_MODEL: Model \"X250\" is not in the fitment table." }] }Does the shopping assistant demo actually behave as described?
Yes, within the scope we tested. On 2026-11-29 we bundled the demo's tool and planner modules with esbuild and ran a Node test script against them. It made 54 checks covering data invariants, every scenario's outcome, the specific guardrails, the tool contracts, and the free-text matcher. All 54 passed. This table shows the scenario results as observed:
| Scenario | Expected behavior | Observed result | Tool calls |
|---|---|---|---|
| Filter for Clearwell X200 | Only the F-100 fits; in stock; cart draft needing confirmation | Cart draft for CW-F100-1, status requires_customer_confirmation; X200 Pro caveat stated | 8 |
| Filter for unknown X250 | Stop at unknown fitment; ask a clarifying question; no cart | UNKNOWN_MODEL on first check; clarifying question listing known models; no cart | 2 |
| Blue jacket, size M | Report stockout; offer only in-stock siblings; no substitution | 0 available; offered blue S (4), blue L (3), navy M (5), red M (2) with a sizing caution; no cart | 7 |
| Return clearance trekking poles | Final sale → not returnable; cite policy | Answered "No", citing POL-FS-1 and the POL-RET-1 exclusion | 4 |
| "I need a battery" | Ambiguous → ask which device | Clarifying question across 5 battery products, with 3 device follow-ups | 6 |
| B500 battery on PowerCore 1000 | Incompatible → say no; offer the listed part only | "No"; offered B1000 (7 in stock) with ground-only shipping note | 6 |
| 4 fuel canisters to Hawaii, express | Policy blocks the line even though it's in stock | prepare_cart rejected the line SHIPPING_RESTRICTED; empty draft | 5 |
| Stove burn time | Spec missing → no estimate; escalate | Escalated; listed only the recorded specs; no number stated | 2 |
| Follow-up: HL-300 battery | Fitting battery in stock → cart draft | Cart draft for LM-HLB1 | 9 |
| Follow-up: HL-500 battery | Fitting battery out of stock; don't offer the incompatible one | Escalated; HL-B1 explicitly not offered | 8 |
Contract-level checks that passed: an empty search query is rejected; get_product responses contain no stock field; a device (not a part) returns NOT_A_PART; cw x200 normalizes to CW-X200; the F-100 is incompatible with CW-X200P; out-of-stock, zero, and fractional quantities are rejected by prepare_cart; fuel by ground to Colorado is allowed; a 1,024 Wh battery by express is blocked; final-sale lines carry a non-returnable note; unknown policy topics and unknown SKUs return NOT_FOUND; and unrelated free text ("what's the weather") matches no intent.
What would a production shopping assistant add?
Mostly the parts this demo deliberately leaves out: a real planner, real data, identity, and monitoring. The tool contracts stay largely the same.
| Area | Demo | Production |
|---|---|---|
| Planning | Scripted per intent | LLM planning constrained to the tool set, with a system policy and a regression eval suite |
| Catalog data | 30 hard-coded products | PIM, catalog, or search index; fitment from a parts database (for example, a year/make/model table or an OEM cross-reference) |
| Inventory and price | Static snapshot | Live inventory and pricing APIs with a freshness budget, revalidated again at checkout (see the inventory sync demo) |
| Identity | None | Authenticated customer context for B2B prices, saved devices, order history; scoped tokens per tool |
| Cart and checkout | Draft object only | Cart created in the store's own platform; checkout through the platform's supported path |
| Monitoring | Unit tests | Tool-call logs, refusal and escalation rates, invented-fact audits, latency, and handoff quality |
| Security | Client-side, no secrets | Input validation, rate limits, least-privilege scopes, and output sanitization, as the MCP security guidance describes |
Where the assistant runs also matters. A headless storefront can host it in its own UI, and the Next.js agentic commerce architecture guide shows where tool servers, caches, and checkout handoff sit. Whether a third-party AI surface will ever call your tools is a separate question about that platform's eligibility. A working tool layer does not guarantee it.
When does a store need a custom shopping assistant instead of a native one?
When product choice depends on data that generic search can't use safely: fitment and compatibility, multi-attribute variants, customer-specific pricing, or shipping and return rules that differ by product. If your products are simple and your platform's native assistant or agentic channel already covers them, you may not need custom work. Check that first. Our AI shopping assistant development service starts with that assessment, and the rest of our demonstrations show the same approach applied elsewhere.
Frequently asked questions
Does this demo use an AI model?
No. The planner is a deterministic script that calls typed tools and branches on their real outputs. That's intentional: the point is to show the tool contracts and guardrails that make any planner safer, including an LLM planner, and the deterministic version is reproducible and testable.
Is this a client project?
No. It's a demonstration built on synthetic data. The store, brands, models, prices, stock levels, and policies are all invented, and nothing here describes a real merchant or their results.
How do you stop a shopping assistant from inventing specs?
Make the product-detail tool the only source of specs, return only the attributes that exist, and have the planner say when an attribute is missing instead of filling the gap. In production you also audit answers against the cited facts. Any claim without a fact behind it counts as a defect.
Why can't the assistant just place the order?
Purchases are sensitive operations, and the MCP tools specification recommends a human in the loop who can deny tool invocations. The assistant drafts a cart. The shopper reviews it and confirms through the store's own checkout, which also handles payment, tax, and fraud checks.
What happens if the shopper's model isn't in the fitment data?
The compatibility tool returns an UNKNOWN_MODEL error rather than a best guess. The assistant asks the shopper to confirm the model number, or escalates to a person. Guessing fitment from a similar name is how wrong-part returns happen.
Could these tools be exposed as an MCP server?
Yes. Each tool maps to an MCP tool definition with an input schema, an optional output schema, and tool execution errors for business-rule failures. Whether a given AI platform will connect to your server is a separate question that depends on that platform's own programs and eligibility rules.
Can I see the code?
The demo runs entirely in your browser, and its tool and planner modules ship with this page. If you want the code or a walkthrough for your own catalog, ask through the contact form.
Does your catalog have a similar problem?
Tell us how shoppers choose your products, whether by fitment, variants, compatibility, or policy rules, and which systems hold that data.
Related
- AI shopping assistant developmentScope an assistant for your catalog's real constraints.
- Ecommerce MCP server developmentBuild the tool layer an assistant or agent calls.
- Inventory-to-feed failure & recovery demoHow stock stays fresh enough for an assistant to trust.
- Headless commerceWhere a custom assistant fits in a headless stack.
- Next.js agentic commerce architectureTool servers, caching, and checkout handoff.
- All demonstrationsOther working artifacts.
Sources
- Agent Commerce Optimization: catalog-assistant demo and test script (built and run 2026-11-29)
- Model Context Protocol specification (2026-07-28): Tools — Tool definitions, inputSchema/outputSchema, isError tool execution errors, human-in-the-loop guidance.
- Model Context Protocol: Security best practices — State-handle hijacking, scope minimization.
- OpenAI Commerce: Product feed specification — availability values; unknown does not mean in stock.
Platform capabilities, eligibility, and specifications change. Sources were checked on 2026-11-29; confirm the current primary documentation before scoping an implementation. See our editorial policy and methodology.