Universal Commerce Protocol (UCP)
How guardrail-sim integrates with the UCP standard for agentic commerce
Universal Commerce Protocol (UCP)
The Universal Commerce Protocol is an open standard for agentic commerce, launched by Shopify and Google. It defines how AI agents interact with e-commerce platforms in a standardized, secure way.
Guardrail-sim is UCP-ready, meaning it produces responses that conform to UCP specifications and can integrate directly into UCP-compliant checkout flows.
Why UCP Matters
As AI agents increasingly handle commerce tasks—from comparison shopping to discount negotiation—there needs to be a common language for:
- Validating discount codes with standard error codes
- Allocating discounts across line items consistently
- Managing checkout sessions with predictable state flows
Guardrail-sim provides the policy enforcement layer that sits between AI agents and your commerce backend.
UCP Discount Extension
The UCP Discount Extension defines how discounts are applied and communicated. Guardrail-sim supports:
Error Codes
When a discount is rejected, we return UCP-standard error codes:
| Error Code | Meaning | Example Violation |
|---|---|---|
discount_code_invalid | Code doesn't exist or is malformed | max_discount, margin_floor |
discount_code_expired | Code is past its validity window | discount_expired |
discount_code_user_ineligible | User doesn't qualify | volume_tier, customer_segment_mismatch |
discount_code_combination_disallowed | Can't stack with other codes | stacking_not_allowed |
discount_code_user_not_logged_in | Requires authentication | login_required |
Allocations
Discounts can be distributed across line items using two methods:
across: Proportional allocation based on item subtotalseach: Even split across all items
MCP Tools for UCP
The guardrail-sim MCP server exposes UCP-aligned tools:
validate_discount_code
Pre-validate a discount code before applying it to a checkout:
simulate_checkout_discount
Simulate a full checkout with discounts:
UCP Types Package
For TypeScript users, import UCP types directly:
Platform Compatibility
Guardrail-sim's UCP implementation is compatible with:
| Platform | Integration | Notes |
|---|---|---|
| Shopify | Types + Error Codes | Uses official UCP schemas |
| Google (Gemini) | MCP Transport | MCP server follows UCP MCP binding |
| Microsoft Copilot | Types | Same UCP schema compliance |
| Generic UCP | Full | Passes conformance tests |