Skip to content

Agent Capabilities ​

Reference for the shopping.agent tool.

Server ​

ItemValue
TransportMCP Streamable HTTP, stateless
Endpointhttps://commerceai.ai/mcp/
AuthAuthorization: Bearer <YOUR_API_KEY> on every request
Server namecommerce-ai-shopping
Toolsshopping.agent (one tool)

The server keeps no MCP session between calls and does not return an Mcp-Session-Id header. Your client stores conversation_id and item_id values and sends them back when needed.

What the tool can do ​

The query text selects the capability. There is no mode parameter.

CapabilityExample queryNeeds
Search"running shoes for flat feet under $120"query
Comparison"compare these two on battery and weight"query + conversation_id + selected_item_ids from an earlier answer
Product Q&A"does this one come with a charger?"query + conversation_id + selected_item_ids
Follow-up"only ones under $30"query + conversation_id
Clarification"a gift for my dad"query; the agent may answer with a question instead of products

Request ​

ParameterTypeRequiredDescription
querystringYesThe shopper's request in natural language, 1 to 4,000 characters. Leading and trailing spaces are trimmed; a blank query is rejected.
conversation_idstringNo32-character lowercase hex id from an earlier call. Omit to start a new conversation. Unknown ids, ids from another account, and expired ids are rejected.
selected_item_idsstring[]Noitem_id values from an earlier answer_items list in the same conversation. Send them unchanged. At most 10, no duplicates. Requires conversation_id. If any value is not valid for this conversation, the whole call is rejected.
marketstringNoTwo uppercase letters. Default US. Any other market gets a refusal without searching and is not charged. Lowercase values are rejected with INVALID_ARGUMENT.
localestringNoBCP 47 locale for the reply, for example en-US. May be ignored for now; replies are in English.
request_idstringNoYour own UUIDv4 or UUIDv7 for this call. The server generates one if omitted. The response always includes request_id. Each id runs one turn: reusing it after that turn returns IDEMPOTENCY_CONFLICT.

Unknown parameters are rejected with INVALID_ARGUMENT.

Response ​

The tool result has two parts:

PartContent
contentOne text block for the model. See Text for the model.
structuredContentThe response object below. Read this in code.

When the call fails, isError is true and structuredContent holds an error object instead. See Errors & Retries.

Response object ​

FieldTypeDescription
request_idstringYour request_id, or the one the server generated. Quote it when you contact support.
conversation_idstring | nullSend this back to continue the conversation. null on a refused request (cart, orders, non-US market, and so on) unless you sent one.
outcomestringWhat kind of result this is: SUCCESS, NEEDS_CLARIFICATION, NO_RESULTS, or UNSUPPORTED. See Outcomes.
answer_textstringThe reply for the shopper, in Markdown, with inline product and table markers. See Answer text.
answer_itemsItem[]The products the answer recommends, in display order. Empty when the agent asks a question, finds nothing, or refuses.
item_comparison_tableobjectPresent only when the agent built a comparison table. See Comparison table.
usageUsageCredits this call used.

The response contains only these fields.

Answer text ​

answer_text is Markdown. It can contain two kinds of self-closing markers on their own lines:

MarkerMeaning
<item_mini_card item_id="pr_..." />Render the product from answer_items with this item_id here.
<item_comparison_table table_ref_id="cmp1" />Render the table item_comparison_table["cmp1"] here.

If you only show text, remove these markers before display. If you render cards, replace each marker with the matching card or table.

Text for the model ​

content[0].text is the same answer as answer_text, rendered as self-contained text for a model to read:

  • Each <item_mini_card> marker is replaced in place by one line: [item_id] name · price · rating/5 · merchant · purchase_url. Empty values are left out.
  • Each <item_comparison_table> marker is replaced in place by a Markdown table whose first column is item_id.
  • The last line is conversation_id: <id>.
text
**Best all-around daily trainer**
NITRO foam provides a smooth, cushioned ride for everyday mileage and varied distances.

[pr_mig9IoxC] Puma Mens Velocity Nitro 3 Running Shoes · $59.95 · 4.5/5 · amazon · https://www.amazon.com/...

conversation_id: e79b7b6c42c348a3b5098150824bb2c2

Give this text to your model, so it can answer from it and send conversation_id and selected_item_ids on follow-ups. Render cards and tables in your UI from structuredContent.

Item ​

FieldTypeDescription
item_idstringOpaque reference to this product, starting with pr_. Pass it in selected_item_ids in the same conversation. Do not parse or build it.
namestringProduct title.
pricenumber | nullPrice as a number, in currency.
price_formattedstring | nullDisplay price with currency symbol, for example "$15.19".
price_min, price_maxnumber | nullPrice range across offers for this product.
currencystringCurrency code, USD.
ratingnumber | nullAverage rating, for example 4.3.
rating_countintegerNumber of ratings. 0 when unknown.
brandstring | nullBrand name.
descriptionstringShort product description.
image_urlstring | nullMain product image.
imagesstring[]All product images.
purchase_urlstring | nullMerchant page where the shopper can buy.
item_sourcestringMerchant the offer comes from, for example walmart.
availabilitystringStock status, for example in_stock.
rankintegerPosition in the agent's recommendation, starting at 1.
rcmd_reasonstring[]Short reasons the agent picked this product.
key_selling_pointobject[]Highlights as {tag, value} pairs, for example {"tag": "Durability", "value": "40 hours playtime"}.
key_attributesobject[]Product attributes as {tag, value} pairs.

Any field can be empty. Render what is present.

Comparison table ​

item_comparison_table maps a table_ref_id to a table:

json
{
  "cmp1": {
    "columns": ["Comparison", "Current price", "Verified total battery", "Water resistance"],
    "rows": [
      {
        "item_id": "pr_xK-ALgZ8",
        "cells": [
          {"value": "Hoey XY60", "value_type": "inner_link", "highlight": false},
          {"value": "$15.19", "highlight": true},
          {"value": "40 hours", "highlight": false},
          {"value": "IPX5", "highlight": false}
        ]
      }
    ]
  }
}
FieldDescription
columnsColumn headers. The first column names the product.
rows[].item_idThe product this row describes. Matches an item_id in answer_items.
rows[].cellsOne cell per column, in column order. value is display text. highlight: true marks the best value in that column. value_type: "inner_link" marks the product name cell.

Usage ​

FieldTypeDescription
credits_usedintegerCredits this call used: input tokens, output tokens, and tool calls added up and rounded up to a whole credit for a completed shopping turn; 0 for a refused request. See Credits.
billing_statusstringPENDING: the charge is recorded and is being deducted from your balance. NOT_REQUIRED: nothing to charge.

The response does not include your balance. Check it in the console. See Credits.

Next ​