add_to_cart
Adds a product to the customer's shopping cart. The product code must come from a previous search or product detail result — never fabricated.
Platform Support
| Platform | Status | Notes |
|---|---|---|
| iOS | Yes | — |
| Android | Yes | — |
Authentication Required
The user must be signed in to use this tool.
Description
Add a product to the shopping cart
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
product_code | string | Yes | — | Product code to add (from search or product detail results) |
quantity | integer | No | 1 | Quantity to add |
Response
| Field | Type | Description |
|---|---|---|
success | boolean | Whether the item was added successfully |
cart_total | string | Updated cart total |
item_count | integer | Total items in cart |
Error Codes
| Code | Description |
|---|---|
AUTH_REQUIRED | User must be signed in |
ADD_TO_CART_FAILED | Product could not be added (out of stock, invalid code, etc.) |
CART_NOT_CONFIGURED | Cart requires a delivery address to be set first |
Source Files
- iOS:
one-app-ios-chat/Chat/Sources/Chat/MCP/EcommerceMCPServer.swift - Android:
chat-pnp-android/mcp-ecommerce/src/main/java/pnp/app/mcp/ecommerce/tools/EcommerceMCPTools.kt