Skip to main content

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

PlatformStatusNotes
iOSYes
AndroidYes
Authentication Required

The user must be signed in to use this tool.

Description

Add a product to the shopping cart

Parameters

NameTypeRequiredDefaultDescription
product_codestringYesProduct code to add (from search or product detail results)
quantityintegerNo1Quantity to add

Response

FieldTypeDescription
successbooleanWhether the item was added successfully
cart_totalstringUpdated cart total
item_countintegerTotal items in cart

Error Codes

CodeDescription
AUTH_REQUIREDUser must be signed in
ADD_TO_CART_FAILEDProduct could not be added (out of stock, invalid code, etc.)
CART_NOT_CONFIGUREDCart 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