Demonstration

AI Shopping Assistant: Catalog-to-Cart Demonstration

By Michael E.Updated Sources checked

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.
Pick a shopper task

Tool calls (8)

SHOPPERFind a replacement filter that fits my Clearwell X200 pitcher.

  1. 1search_catalogok

    Input

    {
      "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. 2check_compatibilityok

    Input

    {
      "productId": "P01",
      "model": "CW-X200"
    }

    Output

    {
      "productId": "P01",
      "model": "CW-X200",
      "status": "compatible",
      "modelName": "Clearwell X200 pitcher",
      "fitsModels": [
        "CW-X200"
      ]
    }
  3. 3check_compatibilityok

    Input

    {
      "productId": "P02",
      "model": "CW-X200"
    }

    Output

    {
      "productId": "P02",
      "model": "CW-X200",
      "status": "incompatible",
      "modelName": "Clearwell X200 pitcher",
      "fitsModels": [
        "CW-X200P",
        "CW-X300"
      ]
    }
  4. 4check_compatibilityok

    Input

    {
      "productId": "P03",
      "model": "CW-X200"
    }

    Output

    {
      "productId": "P03",
      "model": "CW-X200",
      "status": "incompatible",
      "modelName": "Clearwell X200 pitcher",
      "fitsModels": [
        "CW-X300"
      ]
    }
  5. 5check_compatibilityok

    Input

    {
      "productId": "P04",
      "model": "CW-X200"
    }

    Output

    {
      "productId": "P04",
      "model": "CW-X200",
      "status": "incompatible",
      "modelName": "Clearwell X200 pitcher",
      "fitsModels": [
        "CW-T10"
      ]
    }
  6. 6get_productok

    Input

    {
      "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. 7check_inventoryok

    Input

    {
      "sku": "CW-F100-1"
    }

    Output

    {
      "sku": "CW-F100-1",
      "productId": "P01",
      "options": {
        "pack": "1-pack"
      },
      "available": 14,
      "inStock": true
    }
  8. 8prepare_cartok

    Input

    {
      "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

Cart draft (needs confirmation)

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

Cart draft lines
SKUQtyTotal
CW-F100-11$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 = 150
  • catalog/P01/attributes/mediaClearwell F-100 Standard Cartridge: media = activated carbon
  • inventory/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 does it handle unavailable or unsuitable products?

It reports the actual condition, offers only options that the data supports, and asks the shopper before changing anything. Each of the following failure cases is reachable in the demo:

SituationWhat the tools returnWhat the assistant does
Model not in fitment table ("X250")check_compatibility → UNKNOWN_MODELAsks the shopper to check the model label and lists the models it has data for. It doesn't infer fit from similar names.
Requested variant out of stock (blue / M)check_inventory → available: 0Lists in-stock sibling variants with their counts, flags that other sizes fit differently, and waits for a choice. No cart is drafted.
Part exists but doesn't fit (B500 on a PowerCore 1000)check_compatibility → incompatibleSays no plainly and offers only the battery that the fitment table lists for that station.
Only fitting part is out of stock (HL-500 battery)Compatible part has 0 stock; the in-stock part is incompatibleEscalates for a restock date and refuses to offer the in-stock battery that doesn't fit.
Spec not in the catalog (stove burn time)get_product has no burn-time attributeSays the record doesn't list it, quotes the specs that are listed, and escalates. It gives no estimate.
Policy exclusion (fuel to Hawaii by express)prepare_cart → line rejected SHIPPING_RESTRICTEDExplains the restriction with its policy id and makes clear that stock isn't the issue.
Ambiguous request ("I need a battery")search_catalog → 5 batteries for different devicesAsks which device it's for, offering follow-up choices.

These behaviors come from the contracts, not from instructions in a prompt. For example, get_product doesn't expose stock, so a planner can't read stock from the wrong place. And prepare_cart re-checks stock and shipping rules, so a planner bug can't put a restricted item in a cart. That is the core argument for building the tool layer deliberately instead of letting a model call raw store APIs.

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/.

Architecture (demo)
  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 checkout

Every 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_sale on clearance items, hazmat_ground_only on 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 contracts in this demo
ToolInputOutputGuarantee
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_PARTExact 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.

check_compatibility described as an MCP tool (illustrative)
{
  "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 evaluation (tested 2026-11-29, synthetic data)
ScenarioExpected behaviorObserved resultTool calls
Filter for Clearwell X200Only the F-100 fits; in stock; cart draft needing confirmationCart draft for CW-F100-1, status requires_customer_confirmation; X200 Pro caveat stated8
Filter for unknown X250Stop at unknown fitment; ask a clarifying question; no cartUNKNOWN_MODEL on first check; clarifying question listing known models; no cart2
Blue jacket, size MReport stockout; offer only in-stock siblings; no substitution0 available; offered blue S (4), blue L (3), navy M (5), red M (2) with a sizing caution; no cart7
Return clearance trekking polesFinal sale → not returnable; cite policyAnswered "No", citing POL-FS-1 and the POL-RET-1 exclusion4
"I need a battery"Ambiguous → ask which deviceClarifying question across 5 battery products, with 3 device follow-ups6
B500 battery on PowerCore 1000Incompatible → say no; offer the listed part only"No"; offered B1000 (7 in stock) with ground-only shipping note6
4 fuel canisters to Hawaii, expressPolicy blocks the line even though it's in stockprepare_cart rejected the line SHIPPING_RESTRICTED; empty draft5
Stove burn timeSpec missing → no estimate; escalateEscalated; listed only the recorded specs; no number stated2
Follow-up: HL-300 batteryFitting battery in stock → cart draftCart draft for LM-HLB19
Follow-up: HL-500 batteryFitting battery out of stock; don't offer the incompatible oneEscalated; HL-B1 explicitly not offered8

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.

AreaDemoProduction
PlanningScripted per intentLLM planning constrained to the tool set, with a system policy and a regression eval suite
Catalog data30 hard-coded productsPIM, catalog, or search index; fitment from a parts database (for example, a year/make/model table or an OEM cross-reference)
Inventory and priceStatic snapshotLive inventory and pricing APIs with a freshness budget, revalidated again at checkout (see the inventory sync demo)
IdentityNoneAuthenticated customer context for B2B prices, saved devices, order history; scoped tokens per tool
Cart and checkoutDraft object onlyCart created in the store's own platform; checkout through the platform's supported path
MonitoringUnit testsTool-call logs, refusal and escalation rates, invented-fact audits, latency, and handoff quality
SecurityClient-side, no secretsInput 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.

Sources

  1. Agent Commerce Optimization: catalog-assistant demo and test script (built and run 2026-11-29)
  2. Model Context Protocol specification (2026-07-28): Tools — Tool definitions, inputSchema/outputSchema, isError tool execution errors, human-in-the-loop guidance.
  3. Model Context Protocol: Security best practices — State-handle hijacking, scope minimization.
  4. 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.