Skip to main content
Glama

Update cart line

update_cart_item
Destructive

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, 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

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. Changed1 schema field changed
    • addedOutput schema / properties / items / items / properties / set
      Added value: +{
      +  "description": "Only on a line of a matching set: the pair it belongs to (both lines share key) and which part it is.",
      +  "properties": {
      +    "key": {
      +      "type": "string"
      +    },
      +    "role": {
      +      "description": "top or bottom.",
      +      "type": "string"
      +    },
      +    "title": {
      +      "type": "string"
      +    }
      +  },
      +  "type": "object"
      +}
  2. Added

TDQS

A4.6/5.0
Behavior4/5

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

Goes well beyond the annotations: qty 0 deletes, 99 is the cap, size/fabric changes re-price, failures are atomic ('changes nothing') and return the available sizes/fabrics, duplicate lines merge, and set lines have special rules (qty locked to 1, paired fabric change, removal leaves the other line ordinary). The only unstated traits are confirmation/irreversibility framing for the destructive removal path and any auth or rate considerations.

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

Conciseness4/5

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

Front-loaded with the core action and index addressing, then edge cases. Dense but nearly every clause carries decision-relevant information; the set-line sentence is lengthy and parenthetical-heavy, which costs some scannability.

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 four-parameter mutation tool with full schema coverage, annotations, and an output schema, the description covers the operation, index semantics, merge behavior, set-line exceptions, and error outcomes. Nothing an agent needs in order to invoke it correctly is missing; return shape is correctly left to the output schema ('Returns the updated cart').

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 earns above that by adding cross-parameter meaning the schema lacks — qty 0 removes and caps at 99, size and fabric must be supplied together when switching fabric, and set lines constrain both. It stops short of saying how to discover valid size/fabric values beyond observing that errors list them.

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, addressed by its zero-based index from view_cart.' It also names the boundary against the closest sibling ('To add a different product use add_to_cart'), so an agent can distinguish it without inspecting schemas.

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-to-use and when-not-to-use guidance: pass only what changes, use add_to_cart for new products, and re-read view_cart after a removal because indices shift. It also conditions the size+fabric edit ('pass both size and fabric then'), which is exactly the alternative-selection detail an agent needs.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources