Skip to main content
Glama

Update cart line

update_cart_item
Destructive

Modify an existing cart line by zero-based index: set quantity (0 removes it) or change size/fabric to re-price the line; re-read the cart after removal.

Instructions

Change 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 on offer) and changes nothing. Returns the updated cart. To add a different product use add_to_cart.

Input Schema

NameRequiredDescriptionDefault
qtyNoNew quantity; 0 removes the line.
sizeNoNew size for this line (must be available for the product).
indexYesZero-based cart line index from view_cart.
fabricNoNew fabric for this line (must be available for the product).

Output Schema

NameRequiredDescriptionDefault
errorNoPresent instead of a cart when the call failed (bad index, unavailable size, ...).
itemsNoCart lines in index order — this index is what update_cart_item takes.
currencyNo
subtotalNoSum of price x qty over all lines, USD.
checkout_urlNoCart page URL for the human.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.1.0

TDQS

A4.9/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Goes well past the annotations by disclosing that qty=0 deletes the line, the 99 cap, that size/fabric changes re-price the line, that a failed index or unavailable variant is atomic ('changes nothing'), and what is returned. It also warns about index shifting after deletion — a real behavioral trap the annotations cannot convey.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core action, then semantics, then edge-case behavior, then the sibling routing hint. No filler sentences; every clause carries a fact the agent needs.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 4-parameter mutation with an output schema and full annotation coverage, the description covers sourcing the index, partial updates, destructive semantics, error atomicity, and the follow-up re-read. Nothing an agent needs to invoke it correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3; the description adds meaning on top by tying qty=0 to removal, giving the max of 99, and explaining that size/fabric edits trigger re-pricing and must be available for the product. It doesn't add much on the index parameter beyond what the schema already says.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Change one line already in the cart') plus the addressing scheme ('zero-based index from view_cart'). It also explicitly contrasts with add_to_cart, so an agent can distinguish it from the create-path siblings without opening a schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit when/when-not guidance: 'Pass only what changes', 'To add a different product use add_to_cart', and the re-read-view_cart-before-next-edit rule after a removal. The alternative tool is named with the condition that selects it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.