Skip to main content
Glama

Update a cart

update_cart
Destructive

Modify an open cart before checkout. op: 'add' appends items, 'remove' drops items by 0-based index, 'set' replaces the full item list, 'clear' empties the cart. Merges customer details (name, email, phone) via the customer field. Call get_cart afterwards to confirm. Cannot modify a cart that already has a checkout in progress.

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_id": "<cart_id>"
    },
    "name": "update_cart"
  }
}

Input Schema

NameRequiredDescriptionDefault
opNoset
itemsNo
cart_idYes
indicesNoItem indices to remove (0-based) when op='remove'
customerNo

Output Schema

NameRequiredDescriptionDefault
itemsYes
cart_idYes
currencyYes
customerYes
total_zarYes
created_atYes
expires_atYes
item_countYes
updated_atYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true and readOnlyHint=false, but the description adds the real behavioural specifics: 'set' replaces the entire item list and 'clear' empties the cart, which tells the agent exactly what data is lost. It also discloses the checkout-in-progress lock and the customer-detail merge. It stops short of saying prices are recalculated server-side, which is the one remaining behavioural gap.

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?

Four tight sentences: purpose first, operation semantics second, customer merge third, verification and precondition last. No restatement of the title, no filler, and the destructive operations are named up front.

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?

For a destructive mutation with a nested item schema and an output schema present, the definition covers the critical prerequisites, the destructive semantics, and the verification step. Minor omissions (server-side price recalculation, per-item validation rules) are already documented in the schema itself.

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?

With only 20% top-level schema description coverage, the description does the heavy lifting: it defines every enum value of op and clarifies that 'remove' takes 0-based indices, which is non-obvious. It also explains what the customer object merges (name, email, phone). cart_id is left uninterpreted but is self-evident from the required field name.

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 ('Modify an open cart before checkout') and then enumerates the four distinct operations, so an agent knows exactly what the tool does and how to shape the call. The 'before checkout' scope distinguishes it from checkout-mutating siblings like update_checkout or complete_checkout.

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 explicit when-not guidance ('Cannot modify a cart that already has a checkout in progress') and a follow-up step ('Call get_cart afterwards to confirm'). It does not name an alternative for the blocked case, but the guard condition is clear enough for correct routing.

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