Skip to main content
Glama

Storewire Lite demo store

Change a product's quantity in a cart

cart_update_item
DestructiveIdempotent

Sets how many units of a product an anonymous Trailhead Supply cart holds and returns the whole cart; qty 0 removes the product. The product must already be in the cart. A raised quantity is checked against stock as on the website.

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": {
      "cart_token": "<cart_token>",
      "product": "<product>",
      "qty": "<qty>"
    },
    "name": "cart_update_item"
  }
}

Input Schema

NameRequiredDescriptionDefault
qtyYesThe units the cart should hold; 0 removes the product.
localeNoAnswer language: en (default en). Names, labels and URLs follow it.
productYesThe product: its public_id from an earlier answer, its page URL or slug on the store's website, or the manufacturer model number.
cart_tokenYesThe cart_token an earlier cart answer returned.

Output Schema

NameRequiredDescriptionDefault
linesYes
totalNoWhat the cart costs before delivery, discounts taken off; the store's website shows the same.
limitsYes
cart_urlYesOpens the store's website with these products in the shopper's own cart, where they review and order; nothing is ordered before that.
currencyYes
subtotalYesBefore delivery and the bundle saving.
truncatedNoPresent and true only when the answer outgrew the size budget and its last list items were left out; ask narrower to see them.
cart_tokenYesPass it to the other cart tools. A secret: whoever holds it can change this cart.
expires_atYesISO 8601; every change pushes it back.
item_countYesUnits over all lines.
answer_typeNoWhat this answer is, for rendering.
vat_includedYes
delivery_hintYesHow delivery is charged, in the answer language.
discount_totalNoThe bundle saving; 0 without a whole bundle.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.1/5.0
Behavior5/5

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

Goes well beyond the annotations by disclosing that the whole cart is returned, that a raised quantity is validated against stock as shown on the website (an implied failure mode), and that zeroing a quantity deletes the line item. That clarifies exactly what the destructiveHint=true annotation means in practice, which is the added context the lower bar for annotated tools rewards.

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?

Three compact sentences with no waste: the core action and return value come first, followed by the precondition and the stock-check caveat. Every clause carries information an agent needs before calling.

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

Completeness4/5

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

With an output schema present, the description needn't explain return structure, and it covers the key prerequisites and side effects for a mutating cart tool. Minor gaps remain around error behavior when the product is absent or the cart_token is stale, but nothing essential to correct invocation is missing.

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

Parameters3/5

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

Schema coverage is 100%, so qty's absolute-set semantics and the 0-removes rule are already documented in the schema; the description largely restates them. The only added meaning is behavioral (stock validation on increases), not parameter-level clarification of cart_token, product or locale.

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

Purpose4/5

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

States a specific verb and resource: sets the unit count for a product already in an anonymous Trailhead Supply cart, and clarifies that the call returns the whole cart. It implicitly separates itself from cart_add_item via 'The product must already be in the cart' and from cart_remove_item via 'qty 0 removes the product', though it never names those siblings explicitly.

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

Usage Guidelines4/5

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

Gives a clear precondition (the product must already exist in the cart) and an explicit removal mode (qty 0), which is enough context to choose between this and an add/remove tool. It stops short of naming the alternative tools or stating outright when not to use this one.

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.