Skip to main content
Glama

Add to cart

add_cart_item

Adds a product amount on top of the current cart quantity. For a specific total, set the desired quantity instead.

Instructions

Add an amount of a product to the cart, on top of any quantity already there. quantity is in the product sale unit (default 1). Use set_cart_item_quantity instead when the user wants a specific total. If the result has mutation.outcome "unknown", the cart may have changed: call get_cart before any further change and never repeat the request automatically.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
quantityNoAmount to add, in the product sale unit (default 1).
productIdYesproductId from another tool, such as "00123". A product slug ending in that ID (for example "leite-00123") also works.
cartItemIdNoCart line identifier from get_cart. Required to select one of several lines for the same product.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.6.0
    • changedOutput schema / properties / result / anyOf
      Previous value: -[
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "data": {
      -        "additionalProperties": false,
      -        "properties": {
      -          "cartItemId": {
      -            "maxLength": 200,
      -            "minLength": 1,
      -            "pattern": "^[^\\s\\x00-\\x1f\\x7f]+$",
      -            "type": "string"
      -          },
      -          "confirmedQuantity": {
      -            "additionalProperties": false,
      -            "properties": {
      -              "unit": {
      -                "enum": [
      -                  "un",
      -                  "kg",
      -                  "g",
      -                  "l",
      -                  "ml"
      -                ],
      -                "type": "string"
      -              },
      -              "value": {
      -                "minimum": 0,
      -                "type": "number"
      -              }
      -            },
      -            "required": [
      -              "value",
      -              "unit"
      -            ],
      -            "type": "object"
      -          },
      -          "disposition": {
      -            "enum": [
      -              "removed",
      -              "already_absent"
      -            ],
      -            "type": "string"
      -          },
      -          "outcome": {
      -            "const": "confirmed",
      -            "type": "string"
      -          },
      -          "productId": {
      -            "maxLength": 200,
      -            "minLength": 1,
      -            "pattern": "^\\d+$",
      -            "type": "string"
      -          },
      -          "requested": {
      -            "additionalProperties": false,
      -            "properties": {
      -              "unit": {
      -                "enum": [
      -                  "un",
      -                  "kg",
      -                  "g",
      -                  "l",
      -                  "ml"
      -                ],
      -                "type": "string"
      -              },
      -              "value": {
      -                "minimum": 0,
      -                "type": "number"
      -              }
      -            },
      -            "required": [
      -              "value",
      -              "unit"
      -            ],
      -            "type": "object"
      -          }
      -        },
      -        "required": [
      -          "productId",
      -          "requested",
      -          "outcome",
      -          "confirmedQuantity"
      -        ],
      -        "type": "object"
      -      },
      -      "status": {
      -        "enum": [
      -          "success",
      -          "empty",
      -          "partial"
      -        ],
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "status",
      -      "data"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "error": {
      -        "additionalProperties": false,
      -        "properties": {
      -          "code": {
      -            "anyOf": [
      -              {
      -                "enum": [
      -                  "invalid_data",
      -                  "invalid_input",
      -                  "not_authenticated",
      -                  "upstream_unavailable",
      -                  "not_found",
      -                  "sale_rules_unknown",
      -                  "quantity_below_minimum",
      -                  "cart_change_rejected",
      -                  "cart_change_unconfirmed",
      -                  "cache_unavailable",
      -                  "order_details_unavailable",
      -                  "cancelled",
      -                  "deadline_exceeded",
      -                  "server_closed",
      -                  "queue_full"
      -                ],
      -                "type": "string"
      -              },
      -              {
      -                "enum": [
      -                  "internal_error",
      -                  "invalid_result"
      -                ],
      -                "type": "string"
      -              }
      -            ]
      -          },
      -          "issues": {
      -            "items": {
      -              "additionalProperties": false,
      -              "properties": {
      -                "code": {
      -                  "type": "string"
      -                },
      -                "path": {
      -                  "type": "string"
      -                }
      -              },
      -              "required": [
      -                "path",
      -                "code"
      -              ],
      -              "type": "object"
      -            },
      -            "type": "array"
      -          },
      -          "message": {
      -            "minLength": 1,
      -            "type": "string"
      -          },
      -          "retryable": {
      -            "type": "boolean"
      -          }
      -        },
      -        "required": [
      -          "code",
      -          "message",
      -          "retryable"
      -        ],
      -        "type": "object"
      -      },
      -      "mutation": {
      -        "oneOf": [
      -          {
      -            "additionalProperties": false,
      -            "properties": {
      -              "outcome": {
      -                "const": "not_applied",
      -                "type": "string"
      -              }
      -            },
      -            "required": [
      -              "outcome"
      -            ],
      -            "type": "object"
      -          },
      -          {
      -            "additionalProperties": false,
      -            "properties": {
      -              "outcome": {
      -                "const": "unknown",
      -                "type": "string"
      -              },
      -              "recovery": {
      -                "additionalProperties": false,
      -                "properties": {
      -                  "action": {
      -                    "const": "get_cart",
      -                    "type": "string"
      -                  },
      -                  "automaticReplay": {
      -                    "const": false,
      -                    "type": "boolean"
      -                  }
      -                },
      -                "required": [
      -                  "action",
      -                  "automaticReplay"
      -                ],
      -                "type": "object"
      -              }
      -            },
      -            "required": [
      -              "outcome",
      -              "recovery"
      -            ],
      -            "type": "object"
      -          }
      -        ]
      -      },
      -      "status": {
      -        "const": "error",
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "status",
      -      "error"
      -    ],
      -    "type": "object"
      -  }
      -]New value: +[
      +  {
      +    "additionalProperties": false,
      +    "properties": {
      +      "data": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "cartItemId": {
      +            "maxLength": 200,
      +            "minLength": 1,
      +            "pattern": "^[^\\s\\x00-\\x1f\\x7f]+$",
      +            "type": "string"
      +          },
      +          "confirmedQuantity": {
      +            "additionalProperties": false,
      +            "properties": {
      +              "unit": {
      +                "enum": [
      +                  "un",
      +                  "kg",
      +                  "g",
      +                  "l",
      +                  "ml"
      +                ],
      +                "type": "string"
      +              },
      +              "value": {
      +                "minimum": 0,
      +                "type": "number"
      +              }
      +            },
      +            "required": [
      +              "value",
      +              "unit"
      +            ],
      +            "type": "object"
      +          },
      +          "disposition": {
      +            "enum": [
      +              "removed",
      +              "already_absent"
      +            ],
      +            "type": "string"
      +          },
      +          "outcome": {
      +            "const": "confirmed",
      +            "type": "string"
      +          },
      +          "productId": {
      +            "maxLength": 200,
      +            "minLength": 1,
      +            "pattern": "^\\d+$",
      +            "type": "string"
      +          },
      +          "requested": {
      +            "additionalProperties": false,
      +            "properties": {
      +              "unit": {
      +                "enum": [
      +                  "un",
      +                  "kg",
      +                  "g",
      +                  "l",
      +                  "ml"
      +                ],
      +                "type": "string"
      +              },
      +              "value": {
      +                "minimum": 0,
      +                "type": "number"
      +              }
      +            },
      +            "required": [
      +              "value",
      +              "unit"
      +            ],
      +            "type": "object"
      +          }
      +        },
      +        "required": [
      +          "productId",
      +          "requested",
      +          "outcome",
      +          "confirmedQuantity"
      +        ],
      +        "type": "object"
      +      },
      +      "status": {
      +        "enum": [
      +          "success",
      +          "empty",
      +          "partial"
      +        ],
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "status",
      +      "data"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "additionalProperties": false,
      +    "properties": {
      +      "error": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "code": {
      +            "anyOf": [
      +              {
      +                "enum": [
      +                  "invalid_data",
      +                  "invalid_input",
      +                  "not_authenticated",
      +                  "upstream_unavailable",
      +                  "not_found",
      +                  "sale_rules_unknown",
      +                  "quantity_below_minimum",
      +                  "cart_change_rejected",
      +                  "cart_change_unconfirmed",
      +                  "cache_unavailable",
      +                  "order_details_unavailable",
      +                  "cancelled",
      +                  "deadline_exceeded",
      +                  "server_closed",
      +                  "queue_full",
      +                  "browser_unavailable"
      +                ],
      +                "type": "string"
      +              },
      +              {
      +                "enum": [
      +                  "internal_error",
      +                  "invalid_result"
      +                ],
      +                "type": "string"
      +              }
      +            ]
      +          },
      +          "issues": {
      +            "items": {
      +              "additionalProperties": false,
      +              "properties": {
      +                "code": {
      +                  "type": "string"
      +                },
      +                "path": {
      +                  "type": "string"
      +                }
      +              },
      +              "required": [
      +                "path",
      +                "code"
      +              ],
      +              "type": "object"
      +            },
      +            "type": "array"
      +          },
      +          "message": {
      +            "minLength": 1,
      +            "type": "string"
      +          },
      +          "retryable": {
      +            "type": "boolean"
      +          }
      +        },
      +        "required": [
      +          "code",
      +          "message",
      +          "retryable"
      +        ],
      +        "type": "object"
      +      },
      +      "mutation": {
      +        "oneOf": [
      +          {
      +            "additionalProperties": false,
      +            "properties": {
      +              "outcome": {
      +                "const": "not_applied",
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "outcome"
      +            ],
      +            "type": "object"
      +          },
      +          {
      +            "additionalProperties": false,
      +            "properties": {
      +              "outcome": {
      +                "const": "unknown",
      +                "type": "string"
      +              },
      +              "recovery": {
      +                "additionalProperties": false,
      +                "properties": {
      +                  "action": {
      +                    "const": "get_cart",
      +                    "type": "string"
      +                  },
      +                  "automaticReplay": {
      +                    "const": false,
      +                    "type": "boolean"
      +                  }
      +                },
      +                "required": [
      +                  "action",
      +                  "automaticReplay"
      +                ],
      +                "type": "object"
      +              }
      +            },
      +            "required": [
      +              "outcome",
      +              "recovery"
      +            ],
      +            "type": "object"
      +          }
      +        ]
      +      },
      +      "status": {
      +        "const": "error",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "status",
      +      "error"
      +    ],
      +    "type": "object"
      +  }
      +]
  2. First observedv0.2.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already declare it non-read-only, non-idempotent and non-destructive, but the description goes further: it explains the add-vs-set semantics, the 'unknown' mutation outcome, why the cart may be in an indeterminate state, and the safe recovery sequence. This is meaningful behavioral context well beyond the annotation flags.

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 sentences, each load-bearing: one for semantics, one for alternative selection, one for error recovery. The most decision-relevant constraint (additive behavior) is front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/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 not be documented, yet the description still calls out the one return state an agent must act on ('unknown'). Combined with the sibling disambiguation and recovery protocol, nothing needed to call it safely is missing.

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 the schema already documents quantity, productId and cartItemId in detail. The description's note that quantity is in the product sale unit with default 1 largely restates the schema, so the baseline 3 applies.

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 (add), resource (product to cart), and crucially the additive semantics: 'on top of any quantity already there.' This explicitly separates it from set_cart_item_quantity, so an agent can route correctly without opening either schema.

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

Usage Guidelines5/5

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

Names the alternative tool and the exact condition that selects it ('when the user wants a specific total'), and adds a when-to-act rule for the failure path (call get_cart before further changes, never auto-retry). Both are explicit, not inferred.

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