Skip to main content
Glama

Add To Cart

add_to_cart

Adds a product SKU to a specified cart, creating it if absent. Fails if the SKU is unknown or out of stock; does not decrement stock.

Instructions

Add a product to a cart. Does not decrement stock.

Example: cart_id=cart-1, product_id=SKU-1001, qty=1. Use any new cart id; the cart is created if it does not exist. Fails if the SKU is unknown or out of stock (try SKU-1002 to see that error).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
qtyNo
cart_idYesClient-generated cart handle, e.g. cart-123
product_idYesAlphanumeric product SKU (hyphens ok), e.g. SKU-1001

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.7/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does real work: 'Does not decrement stock' is a non-obvious side-effect disclosure, plus auto-creation of missing carts and two explicit failure modes. It omits auth/permission requirements, but for a cart-add this is solid behavioral coverage.

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 the key side-effect caveat in the first two sentences, then the example. The trailing parenthetical '(try SKU-1002 to see that error)' is more test-harness narration than agent guidance and is the only slack.

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?

An output schema exists, so return values need no explanation. The description covers side effects, id semantics, and failure modes, which is most of what an agent needs. It is only thin on qty semantics and cart state after repeated adds.

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 67%: cart_id and product_id are documented in the schema, but qty has no description. The worked example shows qty=1 and the id formats, adding modest value, but it never explains qty bounds, merge behavior for duplicate SKUs, or what happens when qty is omitted.

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 ('Add a product to a cart'), which is immediately distinguishable from siblings like place_order or check_inventory. It does not explicitly name an alternative, but the mutation-vs-query boundary is obvious from the wording.

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?

Adds useful operating context — any new cart id works, the cart is created if absent — and states the failure conditions (unknown SKU, out of stock). However, it never says when to prefer this over check_inventory or place_order, leaving the agent to infer the post-cart workflow.

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