start_checkout was the original “find ⇨ buy” path: an agent calls it once with a SKU,
gets back a hosted Droplinked checkout URL, and hands the buyer off to pay. That works for
single-SKU intent (“buy this thing”) but not for multi-turn agentic composition, where
the agent (or buyer) wants to try a cart configuration before paying.
The four cart-mutation tools close that loop:
| Tool | What it does |
|---|---|
cart.addLine | Add another SKU to an existing cart |
cart.updateLineQuantity | Change the quantity of a SKU already in the cart |
cart.removeLine | Remove a SKU from the cart |
cart.applyDiscount | Apply a merchant-issued discount / coupon code |
cartId returned by start_checkout — pass it back
verbatim; it’s already obfuscated by the backend’s DecryptCartIdPipe.
Canonical multi-line composition flow
cart envelope so the agent can show the running subtotal,
line list, and discount before commit. There is no separate “preview” call — every mutation
is the preview.
Tool reference
cart.addLine
cartId, skuId): calling twice with the same SKU bumps the quantity on
the existing line rather than creating a duplicate.
Backs: POST /v2/carts/:cartId/products
cart.updateLineQuantity
quantity: 0 removes the line — same
effect as calling cart.removeLine but in a single call, which is convenient when the
agent is decrementing.
Backs: PATCH /v2/carts/:cartId/products/:skuId
cart.removeLine
DELETE /v2/carts/:cartId/products/:skuId
cart.applyDiscount
POST /v2/carts/:cartId/coupon
Error envelope
All four tools follow the same envelope shape so agents can branch on JSON instead of catching exceptions:reason enum lets agents branch programmatically (e.g.
reason: "INVALID_COUPON" vs reason: "BACKEND_5XX").
When NOT to use the cart-mutation tools
- Agent only knows the buyer wants one SKU: use
start_checkoutalone. The mutation tools are pure overhead for single-SKU intent. - Agent is composing for an unauthenticated buyer: there is no “guest cart” — the
cart belongs to the email passed to
start_checkout. Mutations apply to that cart. - Agent wants to express discount programmatically: the only discount surface is the
discount code. There is no
cart.applyPercentageOffor similar — merchants own their promo logic via discount codes.
Related
- Inventory MCP — full tool inventory
- MCP Server — installation and environment reference
- Storefront MCP discovery — the
search_products/get_productfamily that precedesstart_checkout - ACP feed — the bulk-discovery feed agents can crawl before cart-composing