# Skill Contract

**Skill ID:** check_cart
**Version:** v1
**Status:** APPROVED

---

## Intent
This skill allows the user to view the current contents of their Century e-member shopping cart, including details for each product and the overall total price.

---

## Inputs
None. All necessary authentication and context are handled by the MCP server, and the underlying `view_cart` tool requires no user-provided inputs.

---

## Outputs
- `cart_items` (list of objects): A list of products currently in the user's cart. Each object within this list contains:
    - `cart_procode` (string): The unique product code.
    - `cart_item_name` (string): The name of the product.
    - `cart_item_quantity` (integer): The number of units of this product in the cart.
    - `cart_discounted_price` (number): The price of a single unit of the product after any discounts.
    - `cart_total_price` (number): The total price for this specific line item (quantity * discounted_price).
- `total_cart_price` (number): The aggregate total monetary value of all items in the shopping cart.

---

## Output Message
"Your shopping cart contains the following items:\n{{#each cart_items}} - {{this.cart_item_name}} ({{this.cart_procode}}), Quantity: {{this.cart_item_quantity}}, Price per item: {{this.cart_discounted_price}}, Total for item: {{this.cart_total_price}}\n{{/each}}Total Cart Price: {{total_cart_price}}"

---

## Logic
1. **External Logic**: Call the `view_cart` MCP tool. This tool does not require any parameters.
2. **Local Logic**: Process the response received from the `view_cart` tool.
3. **Local Logic**: Extract the list of products from the response, mapping them to the `cart_items` output structure including `cart_procode`, `cart_item_name`, `cart_item_quantity`, `cart_discounted_price`, and `cart_total_price` for each item.
4. **Local Logic**: Extract or calculate the `total_cart_price` from the cart data returned by the tool.
5. **Local Logic**: Construct the final output message using the extracted `cart_items` and `total_cart_price` in the specified format.

---

## Additional Logic
- The skill's input collection mode should be configured as 'chat', enabling conversational parameter extraction from the user's natural language input, instead of defaulting to a 'form' interface.

---

## Side Effects
This skill performs a read-only operation and does not modify any system state, user data, or shopping cart contents. There are no side effects.

---

## Capability Summary
This skill allows users to check the contents of their Century e-member shopping cart, providing a detailed list of products and the overall total price.

---

## Allowed Roles
- SUPERUSER

---

## Assumptions
- The `view_cart` MCP tool is consistently available, accessible, and functions as expected, returning valid cart data.
- The MCP server correctly handles user authentication and session context, ensuring that the `view_cart` tool retrieves the current user's cart without explicit input from the skill.
- The data returned by the `view_cart` tool contains all necessary fields to populate the `cart_items` (including `cart_procode`, `cart_item_name`, `cart_item_quantity`, `cart_discounted_price`, `cart_total_price` for each item) and `total_cart_price` outputs.

---

## Non-Goals
- Modifying, adding, or removing items from the shopping cart.
- Proceeding to checkout or handling payment processes.
- Displaying past order history, user profiles, or product recommendations.
- Performing any write operations on the e-commerce system.

---

## Failure Modes
- The `view_cart` MCP tool fails to execute due to network issues, API errors, or internal service problems.
- The user's shopping cart is empty, in which case the skill should gracefully report an empty cart.
- The response format from the `view_cart` tool deviates from expectations, preventing proper parsing and extraction of `cart_items` or `total_cart_price`.
- The user is not properly authenticated or their session has expired, leading to an inability to retrieve cart data.

---

## Data & System Access
- **External System**: Century e-member shopping cart service via the `view_cart` MCP tool.
- **Data**: User's current shopping cart contents (read-only access).

---

## Safety & Risk
Risk Level: LOW

---

## Input Mode
chat

---

## Approval

    Approved by: USER  
    Approved on: 2026-05-06T19:46:31.162492Z