Update cart line
update_cart_itemChange one line already in the cart, addressed by its zero-based index from view_cart: set qty (0 removes the line; max 99) and/or switch size or fabric, which re-prices the line. Pass only what changes. After a removal the lines below move up one index, so re-read view_cart before the next edit. A bad index or an unavailable size/fabric returns an error (with the sizes, or the fabrics, on offer) and changes nothing; a size the new fabric is not made in is refused, so pass both size and fabric then. If the cart already holds the same product, size and fabric, the line merges into it. A Mystery Pack line keeps its sizes. A line of a set (it carries set) keeps qty 1 and never merges; its size changes alone, its fabric changes for both lines of the pair or not at all ('this set is not made in that fabric in these sizes'), and removing it leaves the other line as an ordinary item. Returns the updated cart. To add a different product use add_to_cart.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"index": "<index>"
},
"name": "update_cart_item"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| qty | No | New quantity; 0 removes the line. | |
| size | No | New size for this line (must be available for the product). | |
| index | Yes | Zero-based cart line index from view_cart. | |
| fabric | No | New fabric for this line (must be available for the product). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| error | No | Present instead of a cart when the call failed (bad index, unavailable size, ...). | |
| items | No | Cart lines in index order — this index is what update_cart_item takes. | |
| currency | No | ||
| subtotal | No | Sum of price x qty over all lines, USD. | |
| checkout_url | No | Cart page URL for the human. |