cartwright
API reference

MCP tools

The full tool surface available via /api/mcp and /api/v1/tools.

Cartwright exposes 36 tools across 12 domains. Every tool can be called by an external AI agent (MCP at /api/mcp), a REST client (/api/v1/tools), the storefront chat assistant, or the admin AI — all funneled through the same lib/tools/registry.ts.

This page is a reference catalogue. For the validation pipeline and audit-log behaviour see Architecture: tool registry.

Authentication

All MCP and REST calls require a bearer token from an API key created in /admin/api-keys. Each key carries an explicit list of scopes; tools verify scope before executing.

curl https://my-shop.com/api/mcp \
  -H "Authorization: Bearer sb_live_..." \
  -H "Content-Type: application/json" \
  -d '{"method":"tools/list"}'

For the strict input/output JSON Schema for each tool, hit GET /api/v1/tools (it serializes Zod schemas via zodToJsonSchema).

Scopes catalogue

Scopes are defined in lib/scopes.ts. 19 scopes total across the read/write split:

products:read, products:write
categories:read, categories:write
pages:read, pages:write
discounts:read, discounts:write
orders:read, orders:write
settings:read, settings:write
audit:read, audit:revert
analytics:read
marketing:write
catalog:read   ← read-only catalog access for storefront chat
cart:write     ← cart mutations for storefront chat
customer:read  ← customer lookup for cart/account context

* exists as a wildcard for admin UI keys. Never grant it to a storefront chat session.

Several product/category read tools require catalog:read rather than products:read or categories:read. The latter scopes exist for symmetry but are not currently required by any registered tool. When granting a key, prefer catalog:read for storefront/agent reads.

Tool catalogue

ToolScopeAudit
products.searchcatalog:readskip
products.getcatalog:readskip
products.createproducts:writeyes
products.updateproducts:writeyes
products.deleteproducts:writeyes
products.attach_imageproducts:writeyes
ToolScopeAudit
categories.listcatalog:readskip
categories.upsertcategories:writeyes
categories.deletecategories:writeyes
ToolScopeAudit
orders.listorders:readskip
orders.getorders:readskip
orders.createorders:writeyes
orders.update_statusorders:writeyes
ToolScopeAudit
discounts.listdiscounts:readskip
discounts.creatediscounts:writeyes
discounts.togglediscounts:writeyes
discounts.try_applycart:writeyes
ToolScopeAudit
pages.listpages:readskip
pages.upsertpages:writeyes
pages.deletepages:writeyes
ToolScopeAudit
settings.getsettings:readskip
settings.update_brandingsettings:writeyes
settings.update_shippingsettings:writeyes
ToolScopeAudit
analytics.summaryanalytics:readskip
ToolScopeAudit
marketing.create_campaignmarketing:writeyes
ToolScopeAudit
audit.listaudit:readskip
audit.revertaudit:revertyes
ToolScopeAudit
images.search_unsplashproducts:writeskip

Requires UNSPLASH_ACCESS_KEY env. Falls back gracefully if absent.

ToolScopeAudit
address.autocompletecatalog:readskip
ToolScopeAudit
cart.addcart:writeskip
cart.update_quantitycart:writeskip
cart.removecart:writeskip
cart.get_summarycart:writeskip
customer.lookup_by_emailcustomer:readskip
customer.lookup_by_phonecustomer:readskip
user.get_last_shippingcustomer:readskip

Cart and customer tools assume a storefront chat session with a cookie-based customer context. An API-key-only call with cart:write scope will accept the call but operate on an empty session — you usually want these tools called by the chat assistant, not directly by an external agent.

Example: invoke from an external agent

curl https://my-shop.com/api/mcp \
  -H "Authorization: Bearer sb_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "method": "tools/call",
    "params": {
      "name": "products.search",
      "arguments": { "q": "aviator", "limit": 5 }
    }
  }'

For the exact response envelope and JSON Schema of each tool's inputSchema, query GET /api/v1/tools against your shop.

On this page