diff --git a/source/services/shopping/mcp.openrpc.json b/source/services/shopping/mcp.openrpc.json index 2908d8d45..93cf27882 100644 --- a/source/services/shopping/mcp.openrpc.json +++ b/source/services/shopping/mcp.openrpc.json @@ -65,9 +65,36 @@ "type": "string", "format": "uuid", "description": "Unique key for retry safety. Maps to HTTP Idempotency-Key header." + }, + "request-id": { + "type": "string", + "format": "uuid", + "description": "Unique request identifier for tracing across network layers. Maps to HTTP Request-Id header." } } } + }, + "errors": { + "authentication_failed": { + "code": -32002, + "message": "Authentication failed", + "data": { "$ref": "../../schemas/common/types/error_response.json" } + }, + "invalid_params": { + "code": -32602, + "message": "Invalid params", + "data": { "$ref": "../../schemas/common/types/error_response.json" } + }, + "not_found": { + "code": -32001, + "message": "Resource not found", + "data": { "$ref": "../../schemas/common/types/error_response.json" } + }, + "idempotency_conflict": { + "code": -32003, + "message": "Idempotency conflict", + "data": { "$ref": "../../schemas/common/types/error_response.json" } + } } }, "methods": [ @@ -78,119 +105,184 @@ "params": [ { "name": "meta", + "description": "Request metadata containing platform identification and optional idempotency key.", "required": true, - "schema": {"$ref": "#/components/schemas/meta"} + "schema": { "$ref": "#/components/schemas/meta" } }, { "name": "checkout", + "description": "Checkout session state to create.", "required": true, - "schema": {"$ref": "../../schemas/shopping/checkout.json"} + "schema": { "$ref": "../../schemas/shopping/checkout.json" } } ], "result": { "name": "checkout", - "schema": {"$ref": "#/components/schemas/checkout_result"} - } + "description": "The created checkout session or an error response.", + "schema": { "$ref": "#/components/schemas/checkout_result" } + }, + "errors": [ + { "$ref": "#/components/errors/authentication_failed" }, + { "$ref": "#/components/errors/invalid_params" }, + { "$ref": "#/components/errors/idempotency_conflict" } + ] }, { "name": "get_checkout", "summary": "Get checkout", + "description": "Get the latest state of a checkout session.", "params": [ { "name": "meta", + "description": "Request metadata containing platform identification.", "required": true, - "schema": {"$ref": "#/components/schemas/meta"} + "schema": { "$ref": "#/components/schemas/meta" } }, { "name": "id", + "description": "The unique identifier of the checkout session.", "required": true, - "schema": {"type": "string"} + "schema": { + "type": "string" + } } ], "result": { "name": "checkout", - "schema": {"$ref": "#/components/schemas/checkout_result"} - } + "description": "The current checkout session state or an error response.", + "schema": { "$ref": "#/components/schemas/checkout_result" } + }, + "errors": [ + { "$ref": "#/components/errors/authentication_failed" }, + { "$ref": "#/components/errors/not_found" } + ] }, { "name": "update_checkout", "summary": "Update checkout", + "description": "Update a checkout session. If an optional field is provided, its value replaces the corresponding data. If omitted, the current value is unchanged.", "params": [ { "name": "meta", + "description": "Request metadata containing platform identification.", "required": true, - "schema": {"$ref": "#/components/schemas/meta"} + "schema": { "$ref": "#/components/schemas/meta" } }, { "name": "id", + "description": "The unique identifier of the checkout session.", "required": true, - "schema": {"type": "string"} + "schema": { + "type": "string" + } }, { "name": "checkout", + "description": "Checkout session fields to update.", "required": true, - "schema": {"$ref": "../../schemas/shopping/checkout.json"} + "schema": { "$ref": "../../schemas/shopping/checkout.json" } } ], "result": { "name": "checkout", - "schema": {"$ref": "#/components/schemas/checkout_result"} - } + "description": "The updated checkout session or an error response.", + "schema": { "$ref": "#/components/schemas/checkout_result" } + }, + "errors": [ + { "$ref": "#/components/errors/authentication_failed" }, + { "$ref": "#/components/errors/invalid_params" }, + { "$ref": "#/components/errors/not_found" } + ] }, { "name": "complete_checkout", "summary": "Complete checkout and place order", + "description": "Place the order.", "params": [ { "name": "meta", + "description": "Request metadata containing platform identification and required idempotency key.", "required": true, "schema": { "allOf": [ - {"$ref": "#/components/schemas/meta"}, - {"required": ["ucp-agent", "idempotency-key"]} + { "$ref": "#/components/schemas/meta" }, + { + "required": [ + "ucp-agent", + "idempotency-key" + ] + } ] } }, { "name": "id", + "description": "The unique identifier of the checkout session.", "required": true, - "schema": {"type": "string"} + "schema": { + "type": "string" + } }, { "name": "checkout", + "description": "Final checkout state for order placement.", "required": true, - "schema": {"$ref": "../../schemas/shopping/checkout.json"} + "schema": { "$ref": "../../schemas/shopping/checkout.json" } } ], "result": { "name": "checkout", - "schema": {"$ref": "#/components/schemas/checkout_result"} - } + "description": "The completed checkout session or an error response.", + "schema": { "$ref": "#/components/schemas/checkout_result" } + }, + "errors": [ + { "$ref": "#/components/errors/authentication_failed" }, + { "$ref": "#/components/errors/invalid_params" }, + { "$ref": "#/components/errors/not_found" }, + { "$ref": "#/components/errors/idempotency_conflict" } + ] }, { "name": "cancel_checkout", "summary": "Cancel checkout", + "description": "Cancel a checkout session.", "params": [ { "name": "meta", + "description": "Request metadata containing platform identification and required idempotency key.", "required": true, "schema": { "allOf": [ - {"$ref": "#/components/schemas/meta"}, - {"required": ["ucp-agent", "idempotency-key"]} + { "$ref": "#/components/schemas/meta" }, + { + "required": [ + "ucp-agent", + "idempotency-key" + ] + } ] } }, { "name": "id", + "description": "The unique identifier of the checkout session.", "required": true, - "schema": {"type": "string"} + "schema": { + "type": "string" + } } ], "result": { "name": "checkout", - "schema": {"$ref": "#/components/schemas/checkout_result"} - } + "description": "The cancelled checkout session or an error response.", + "schema": { "$ref": "#/components/schemas/checkout_result" } + }, + "errors": [ + { "$ref": "#/components/errors/authentication_failed" }, + { "$ref": "#/components/errors/invalid_params" }, + { "$ref": "#/components/errors/not_found" }, + { "$ref": "#/components/errors/idempotency_conflict" } + ] }, { "name": "create_cart", @@ -199,89 +291,136 @@ "params": [ { "name": "meta", + "description": "Request metadata containing platform identification and optional idempotency key.", "required": true, - "schema": {"$ref": "#/components/schemas/meta"} + "schema": { "$ref": "#/components/schemas/meta" } }, { "name": "cart", + "description": "Cart session state to create.", "required": true, - "schema": {"$ref": "../../schemas/shopping/cart.json"} + "schema": { "$ref": "../../schemas/shopping/cart.json" } } ], "result": { "name": "cart", - "schema": {"$ref": "#/components/schemas/cart_result"} - } + "description": "The created cart session or an error response.", + "schema": { "$ref": "#/components/schemas/cart_result" } + }, + "errors": [ + { "$ref": "#/components/errors/authentication_failed" }, + { "$ref": "#/components/errors/invalid_params" }, + { "$ref": "#/components/errors/idempotency_conflict" } + ] }, { "name": "get_cart", "summary": "Get cart", + "description": "Get the latest state of a cart session.", "params": [ { "name": "meta", + "description": "Request metadata containing platform identification.", "required": true, - "schema": {"$ref": "#/components/schemas/meta"} + "schema": { "$ref": "#/components/schemas/meta" } }, { "name": "id", + "description": "The unique identifier of the cart session.", "required": true, - "schema": {"type": "string"} + "schema": { + "type": "string" + } } ], "result": { "name": "cart", - "schema": {"$ref": "#/components/schemas/cart_result"} - } + "description": "The current cart session state or an error response.", + "schema": { "$ref": "#/components/schemas/cart_result" } + }, + "errors": [ + { "$ref": "#/components/errors/authentication_failed" }, + { "$ref": "#/components/errors/not_found" } + ] }, { "name": "update_cart", "summary": "Update cart", + "description": "Update a cart session.", "params": [ { "name": "meta", + "description": "Request metadata containing platform identification.", "required": true, - "schema": {"$ref": "#/components/schemas/meta"} + "schema": { "$ref": "#/components/schemas/meta" } }, { "name": "id", + "description": "The unique identifier of the cart session.", "required": true, - "schema": {"type": "string"} + "schema": { + "type": "string" + } }, { "name": "cart", + "description": "Cart session fields to update.", "required": true, - "schema": {"$ref": "../../schemas/shopping/cart.json"} + "schema": { "$ref": "../../schemas/shopping/cart.json" } } ], "result": { "name": "cart", - "schema": {"$ref": "#/components/schemas/cart_result"} - } + "description": "The updated cart session or an error response.", + "schema": { "$ref": "#/components/schemas/cart_result" } + }, + "errors": [ + { "$ref": "#/components/errors/authentication_failed" }, + { "$ref": "#/components/errors/invalid_params" }, + { "$ref": "#/components/errors/not_found" } + ] }, { "name": "cancel_cart", "summary": "Cancel cart", + "description": "Cancel a cart session. Returns the cart state at time of cancellation.", "params": [ { "name": "meta", + "description": "Request metadata containing platform identification and required idempotency key.", "required": true, "schema": { "allOf": [ - {"$ref": "#/components/schemas/meta"}, - {"required": ["ucp-agent", "idempotency-key"]} + { "$ref": "#/components/schemas/meta" }, + { + "required": [ + "ucp-agent", + "idempotency-key" + ] + } ] } }, { "name": "id", + "description": "The unique identifier of the cart session.", "required": true, - "schema": {"type": "string"} + "schema": { + "type": "string" + } } ], "result": { "name": "cart", - "schema": {"$ref": "#/components/schemas/cart_result"} - } + "description": "The cancelled cart session or an error response.", + "schema": { "$ref": "#/components/schemas/cart_result" } + }, + "errors": [ + { "$ref": "#/components/errors/authentication_failed" }, + { "$ref": "#/components/errors/invalid_params" }, + { "$ref": "#/components/errors/not_found" }, + { "$ref": "#/components/errors/idempotency_conflict" } + ] }, { "name": "search_catalog", @@ -290,19 +429,26 @@ "params": [ { "name": "meta", + "description": "Request metadata containing platform identification.", "required": true, - "schema": {"$ref": "#/components/schemas/meta"} + "schema": { "$ref": "#/components/schemas/meta" } }, { "name": "catalog", + "description": "Catalog search query parameters.", "required": true, - "schema": {"$ref": "../../schemas/shopping/catalog_search.json#/$defs/search_request"} + "schema": { "$ref": "../../schemas/shopping/catalog_search.json#/$defs/search_request" } } ], "result": { "name": "response", - "schema": {"$ref": "../../schemas/shopping/catalog_search.json#/$defs/search_response"} - } + "description": "Catalog search results.", + "schema": { "$ref": "../../schemas/shopping/catalog_search.json#/$defs/search_response" } + }, + "errors": [ + { "$ref": "#/components/errors/authentication_failed" }, + { "$ref": "#/components/errors/invalid_params" } + ] }, { "name": "lookup_catalog", @@ -311,19 +457,26 @@ "params": [ { "name": "meta", + "description": "Request metadata containing platform identification.", "required": true, - "schema": {"$ref": "#/components/schemas/meta"} + "schema": { "$ref": "#/components/schemas/meta" } }, { "name": "catalog", + "description": "Catalog lookup request parameters.", "required": true, - "schema": {"$ref": "../../schemas/shopping/catalog_lookup.json#/$defs/lookup_request"} + "schema": { "$ref": "../../schemas/shopping/catalog_lookup.json#/$defs/lookup_request" } } ], "result": { "name": "response", - "schema": {"$ref": "../../schemas/shopping/catalog_lookup.json#/$defs/lookup_response"} - } + "description": "Catalog lookup results.", + "schema": { "$ref": "../../schemas/shopping/catalog_lookup.json#/$defs/lookup_response" } + }, + "errors": [ + { "$ref": "#/components/errors/authentication_failed" }, + { "$ref": "#/components/errors/invalid_params" } + ] }, { "name": "get_order", @@ -332,19 +485,28 @@ "params": [ { "name": "meta", + "description": "Request metadata containing platform identification.", "required": true, - "schema": {"$ref": "#/components/schemas/meta"} + "schema": { "$ref": "#/components/schemas/meta" } }, { "name": "id", "required": true, - "schema": {"type": "string", "description": "The unique identifier of the order."} + "schema": { + "type": "string", + "description": "The unique identifier of the order." + } } ], "result": { "name": "order", - "schema": {"$ref": "#/components/schemas/order_result"} - } + "description": "The current order state or an error response.", + "schema": { "$ref": "#/components/schemas/order_result" } + }, + "errors": [ + { "$ref": "#/components/errors/authentication_failed" }, + { "$ref": "#/components/errors/not_found" } + ] }, { "name": "get_product", @@ -353,19 +515,26 @@ "params": [ { "name": "meta", + "description": "Request metadata containing platform identification.", "required": true, - "schema": {"$ref": "#/components/schemas/meta"} + "schema": { "$ref": "#/components/schemas/meta" } }, { "name": "catalog", + "description": "Product detail request parameters.", "required": true, - "schema": {"$ref": "../../schemas/shopping/catalog_lookup.json#/$defs/get_product_request"} + "schema": { "$ref": "../../schemas/shopping/catalog_lookup.json#/$defs/get_product_request" } } ], "result": { "name": "response", - "schema": {"$ref": "#/components/schemas/catalog_get_product_result"} - } + "description": "Product details or an error response.", + "schema": { "$ref": "#/components/schemas/catalog_get_product_result" } + }, + "errors": [ + { "$ref": "#/components/errors/authentication_failed" }, + { "$ref": "#/components/errors/invalid_params" } + ] } ] } diff --git a/source/services/shopping/rest.openapi.json b/source/services/shopping/rest.openapi.json index 4ea716214..5a2219b8b 100644 --- a/source/services/shopping/rest.openapi.json +++ b/source/services/shopping/rest.openapi.json @@ -92,6 +92,36 @@ } } } + }, + "400": { + "description": "Request body failed validation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + }, + "401": { + "description": "Authentication failed or missing credentials.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + }, + "409": { + "description": "Idempotency conflict. A request with this Idempotency-Key was already processed with different parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } } } } @@ -160,6 +190,26 @@ } } } + }, + "401": { + "description": "Authentication failed or missing credentials.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + }, + "404": { + "description": "Resource not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } } } }, @@ -237,6 +287,46 @@ } } } + }, + "400": { + "description": "Request body failed validation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + }, + "401": { + "description": "Authentication failed or missing credentials.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + }, + "404": { + "description": "Resource not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + }, + "409": { + "description": "Idempotency conflict. A request with this Idempotency-Key was already processed with different parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } } } } @@ -317,6 +407,46 @@ "schema": { "$ref": "#/components/schemas/checkout_response" } } } + }, + "400": { + "description": "Request body failed validation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + }, + "401": { + "description": "Authentication failed or missing credentials.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + }, + "404": { + "description": "Resource not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + }, + "409": { + "description": "Idempotency conflict. A request with this Idempotency-Key was already processed with different parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } } } } @@ -391,6 +521,36 @@ } } } + }, + "401": { + "description": "Authentication failed or missing credentials.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + }, + "404": { + "description": "Resource not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + }, + "409": { + "description": "Idempotency conflict. A request with this Idempotency-Key was already processed with different parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } } } } @@ -436,6 +596,36 @@ "schema": { "$ref": "#/components/schemas/cart_response" } } } + }, + "400": { + "description": "Request body failed validation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + }, + "401": { + "description": "Authentication failed or missing credentials.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + }, + "409": { + "description": "Idempotency conflict. A request with this Idempotency-Key was already processed with different parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } } } } @@ -474,6 +664,26 @@ "schema": { "$ref": "#/components/schemas/cart_response" } } } + }, + "401": { + "description": "Authentication failed or missing credentials.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + }, + "404": { + "description": "Resource not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } } } }, @@ -517,6 +727,46 @@ "schema": { "$ref": "#/components/schemas/cart_response" } } } + }, + "400": { + "description": "Request body failed validation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + }, + "401": { + "description": "Authentication failed or missing credentials.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + }, + "404": { + "description": "Resource not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + }, + "409": { + "description": "Idempotency conflict. A request with this Idempotency-Key was already processed with different parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } } } } @@ -557,6 +807,36 @@ "schema": { "$ref": "#/components/schemas/cart_response" } } } + }, + "401": { + "description": "Authentication failed or missing credentials.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + }, + "404": { + "description": "Resource not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + }, + "409": { + "description": "Idempotency conflict. A request with this Idempotency-Key was already processed with different parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } } } } @@ -601,6 +881,26 @@ "schema": { "$ref": "#/components/schemas/catalog_search_response" } } } + }, + "400": { + "description": "Request body failed validation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + }, + "401": { + "description": "Authentication failed or missing credentials.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } } } } @@ -645,6 +945,26 @@ "schema": { "$ref": "#/components/schemas/catalog_lookup_response" } } } + }, + "400": { + "description": "Request body failed validation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + }, + "401": { + "description": "Authentication failed or missing credentials.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } } } } @@ -683,6 +1003,26 @@ "schema": { "$ref": "#/components/schemas/order_response" } } } + }, + "401": { + "description": "Authentication failed or missing credentials.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + }, + "404": { + "description": "Resource not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } } } } @@ -727,6 +1067,26 @@ "schema": { "$ref": "#/components/schemas/catalog_get_product_response" } } } + }, + "400": { + "description": "Request body failed validation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + }, + "401": { + "description": "Authentication failed or missing credentials.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } } } } @@ -1021,6 +1381,9 @@ { "$ref": "../../schemas/shopping/catalog_lookup.json#/$defs/get_product_response" }, { "$ref": "../../schemas/common/types/error_response.json" } ] + }, + "error_response": { + "$ref": "../../schemas/common/types/error_response.json" } } }