Skip to main content
Glama

Add to basket

add_to_basket

Use this when someone asks to add teas.co.uk products to their basket. Each quantity is added to what is already there, so a product already in the basket goes up by that amount. Ids come from find_products. If any id is unknown, the call fails, names that id and adds nothing. A product that cannot be added (out of stock, or over the 20 kg parcel limit) is listed in messages while the rest are added. Nothing is bought or charged. Leave basket_id out on hosts that identify the customer; otherwise pass the basket_id from the first basket result every time. To change or remove a line use update_basket. To buy chosen products straight away use checkout_session.

Input Schema

NameRequiredDescriptionDefault
itemsYesProducts and quantities to add.
basket_idNoOnly for hosts that do not identify the user: the basket_id returned by an earlier basket tool in this conversation. Leave it out otherwise.
idempotency_keyNoOptional. A unique key for this change (8 to 128 letters, digits or . _ : -). Sending the same key again within 24 hours returns the first answer instead of making the change twice.

Output Schema

NameRequiredDescriptionDefault
addedNoHow many products were added.
itemsYesNumber of items in the basket.
linesYes
deliveryYes
messagesYesAnything that could not be added or changed, in plain words.
subtotalNoPounds including VAT, before delivery.
basket_idNoPresent only when the host did not identify the user: pass it to later basket tools.
subtotal_textYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / idempotency_key
      Added value: +{
      +  "description": "Optional. A unique key for this change (8 to 128 letters, digits or . _ : -). Sending the same key again within 24 hours returns the first answer instead of making the change twice.",
      +  "maxLength": 128,
      +  "minLength": 8,
      +  "pattern": "^[A-Za-z0-9._:-]{8,128}$",
      +  "type": "string"
      +}
  2. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Goes well beyond the annotations: additive quantity semantics, atomic failure on unknown ids, partial success with per-item messages for out-of-stock/20 kg limit, 'nothing is bought or charged'. These are the exact side-effect details an agent needs before mutating a basket.

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 trigger and side-effect profile; every sentence carries operational content. Slightly long at six sentences, but none is filler given the failure-mode and host-variation detail.

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?

Output schema exists so return values need no explanation, and the description covers the remaining gaps: failure modes, partial application, host-dependent basket_id, and confirmation that no purchase occurs.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds real meaning: quantities are cumulative rather than replacing, ids must originate from find_products, and basket_id is host-dependent. The idempotency_key dedup behavior is left to the schema.

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?

Specific verb+resource ('add teas.co.uk products to their basket') with a clear trigger condition ('when someone asks to add...'). It also distinguishes itself from siblings by naming update_basket and checkout_session as different operations.

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?

Explicit routing: use update_basket to change/remove a line, checkout_session to buy immediately. It also gives the condition for when to pass basket_id ('leave out on hosts that identify the customer; otherwise pass the basket_id from the first basket result').

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.

Resources