Skip to main content
Glama

Add to cart

add_to_cart

Add products by SKU and quantity to a guest cart, then receive the updated cart with line items and totals. Per-item issues are returned as user_errors without failing the entire request.

Instructions

Add one or more products (by SKU and quantity) to a guest cart. Returns the updated cart with line items and totals. Per-item problems (out of stock, unknown SKU, configurable products needing options) are reported in user_errors rather than failing the whole call.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
itemsYesOne or more products to add to the cart.
cart_idYesThe guest cart id returned by create_guest_cart.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/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 it delivers meaningful behavioral insight: per-item failures (out of stock, unknown SKU, configurable products needing options) are collected in user_errors instead of failing the entire call. It also discloses the return shape (updated cart with line items and totals). It does not cover aspects like cart validation or quantity merge semantics, but the disclosed error model is substantial and actionable.

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 dense sentences, front-loaded with the primary action, followed by return value and error-handling behavior. Every sentence contributes essential information with no filler or repetition.

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?

Since there is no output schema, the description explicitly states what is returned (updated cart with line items and totals) and how errors are surfaced (user_errors). It covers the main invocation outcome and the partial-failure behavior. It is slightly light on prerequisites and edge cases, but for a two-parameter guest-cart tool this is a solid, usable description.

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?

The schema has 100% description coverage, with clear explanations for cart_id, items, sku, and quantity. The description adds only an echo of 'by SKU and quantity' and does not supplement parameter meaning beyond the schema. Baseline 3 is appropriate because the schema already documents parameters fully.

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?

The description opens with a specific verb and resource: 'Add one or more products (by SKU and quantity) to a guest cart.' It clearly distinguishes this from sibling tools such as view_cart, check_stock, and create_guest_cart. The mention of returning the updated cart with line items and totals further pins down the tool's role.

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?

The description makes the use case clear: adding products to a guest cart. It implies a prerequisite via 'guest cart' plus the schema's reference to create_guest_cart, but it does not explicitly state when to avoid this tool or name alternatives. Still, the context is clear enough for an agent to know this is the relevant action for populating a cart.

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