Skip to main content
Glama

add_to_cart

Add a product variant (or base product) to an existing cart. Reuse the active cart_id from the chat history if one already exists. Only call create_cart first if no cart exists yet.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailNoBuyer email; arms a back-in-stock alert for any out-of-stock item in items[].
itemsNoAdd several products in ONE call instead of calling this tool repeatedly. Each entry: { product_id, quantity, variant_id?, addons? }. Out-of-stock items are reported; pass `email` to auto-arm a back-in-stock alert for them.
addonsNoSelected product add-ons as a map of addon_id -> chosen value(s). For select/radio/boolean pass a single value; for checkbox/multi pass an array; for text/number pass the value. Values for choice add-ons MUST come from the product's addons[].options[].value. Collect any addon with required:true before checkout.
cart_idNoCart ID to add the product to
site_idYesRegistered site ID
quantityNoQuantity to add (must be >= 1)
product_idNoProduct ID to add
variant_idNoOptional product variant ID (e.g., for size/color selection)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
kindYes
itemsYes
totalYes
cartIdYes
siteIdYes
subtotalYes
discountsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4/5.0
Behavior3/5

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

Annotations already indicate readOnlyHint=false and destructiveHint=false. Description adds context about reusing cart_id and precondition (cart must exist). No contradictions, but behavioral disclosure beyond annotations is minimal.

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?

Description is two sentences, front-loaded with the core action. No fluff; every word earns its place.

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?

Given the tool's complexity (8 params, nested objects, output schema), the description covers the essential context: action, precondition, and reuse of cart_id. It does not need to detail return values as output schema exists.

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 description coverage is 100%, so each parameter is well-documented in the schema. Description adds minimal extra meaning (e.g., reusing cart_id), but the schema already carries the burden.

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?

Description explicitly states action (add) and resource (product variant/base product to cart). Distinguishes from sibling create_cart by specifying when to use each.

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?

Provides clear guidance to reuse existing cart_id from chat history and to call create_cart only if no cart exists. Lacks explicit exclusion for other alternatives like update_cart or remove_from_cart, but context is sufficient.

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.