Skip to main content
Glama

Set cart quantity

cart_set_quantity

Updates the quantity of a specific cart line; set it to 0 to remove that item from the cart.

Instructions

Set the quantity of one cart line (0 removes it). 修改购物车某一行的数量,0 表示删除;lineKey 来自 cart_view。

Input Schema

NameRequiredDescriptionDefault
lineKeyYescart_view 返回的 lineKey(也可以用 linkId)
quantityYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.7/5.0
Behavior4/5

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

The annotations already declare readOnlyHint=false, destructiveHint=false and openWorldHint=true, so the bar is lower. The description adds genuinely non-obvious behavior: quantity 0 deletes the line, an effect not visible from the schema's minimum: 0, and it points at the source of the key (cart_view). It omits any note on permissions, rate limits, or what state the cart is left in afterwards.

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?

Two sentences, front-loaded with the core action and the destructive edge case. The Chinese clause restates the English for a bilingual audience; that is defensible but slightly redundant for a single-language reader.

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 two-parameter mutation with no output schema and annotations covering the safety profile, the description tells the agent the action, the removal side effect, and where lineKey comes from. Missing only post-call expectations (e.g., whether a refreshed cart is returned or cart_view must be re-called).

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 50%: lineKey is documented in the schema while quantity has only min/max bounds. The description compensates for quantity by defining the 0 = remove semantics, which is meaningful, but it adds nothing about the upper bound (99) or about stale/invalid lineKeys.

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+resource ('Set the quantity of one cart line') and parenthetically clarifies the zero-quantity edge case, which distinguishes it from cart_add/cart_clear. It doesn't explicitly name the siblings it supersedes (cart_remove, cart_clear), so an agent must infer the boundary from the parenthetical.

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

Usage Guidelines3/5

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

Provides one real workflow prerequisite — 'lineKey 来自 cart_view' — which tells the agent where to obtain the required key. However, there is no statement of when to prefer this over cart_add, cart_remove, or cart_clear, so the choice among mutating siblings is left to inference.

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