Skip to main content
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: All four expect the encrypted cartId returned by start_checkout — pass it back verbatim; it’s already obfuscated by the backend’s DecryptCartIdPipe.

Canonical multi-line composition flow

Each step returns the updated 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

Idempotent on (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

Sets the line to the specified quantity. Passing 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

Removes the line entirely. The returned cart shows the updated lines + total. Removing the last line leaves the cart empty but still usable — the buyer can continue browsing and the agent can add new lines. Backs: DELETE /v2/carts/:cartId/products/:skuId

cart.applyDiscount

Validates the discount code at the merchant level, computes the discount, and returns the updated cart with the discount amount + label resolved. The code is case-insensitive on the backend but is preserved on the MCP surface so agents can run idempotency checks against the exact value they sent. An invalid or expired code surfaces as a structured error envelope. Backs: 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:
The structured 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_checkout alone. 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.applyPercentageOff or similar — merchants own their promo logic via discount codes.