create_cart_link
Create a pre-filled shopping cart URL for Rakentaja Outlet.
Given a list of product IDs and quantities, returns a URL that the user can open in their browser. When they open the link, the items are added to their browser cart session, and they are redirected either to the cart page (default) or directly to checkout.
This tool is FULLY SIDE-EFFECT-FREE: it does not create the cart on the server, does not touch any database, and does not modify any state. The cart materializes only when the user chooses to open the URL. This is a deliberate security design — the user always approves cart contents visibly before the state change happens.
Args:
items: List of {"product_id": int, "quantity": int} dicts.
Maximum 20 items, maximum quantity 50 per line.
Use search_catalog + get_product_details to find IDs first.
checkout: If True, the link takes the user directly to checkout
(skipping the cart review page). Default False — user sees
the cart first, which is safer and more transparent.
Returns: JSON with: - url: the browser URL to give the user. Contains all cart items as query parameters. Opening it will populate their cart. - items: deduplicated items list that will be added (same product_id appearing multiple times is merged with combined quantity) - total_lines: number of unique products in the link - total_quantity: sum of quantities across all products - checkout: echoed checkout flag - disclaimer: legal notice about approval flow
On error, raises MCP ToolError → response has isError:true with
structured JSON: {"error": {"code": "empty_items" | "too_many_items"
| "invalid_item" | "quantity_too_large" | "products_not_found"
| "backend_unavailable", "message": "...", "field": null,
"retryable": true|false}}. The StructuredErrorMiddleware ensures
consistent format across all tools.Example: create_cart_link(items=[ {"product_id": 9437, "quantity": 2}, {"product_id": 4927, "quantity": 1}, ]) → {"url": "https://rakentajaoutlet.fi/mcp-backend/lisaa-kori?items=9437:2,4927:1", ...}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| items | Yes | Cart items (1-20 lines) | |
| checkout | No | If True, link goes directly to checkout; otherwise to cart review page |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | Browser URL to give the user — opening it populates their cart | |
| items | Yes | Deduplicated cart items | |
| checkout | Yes | If true, link takes user directly to checkout | |
| disclaimer | Yes | ||
| total_lines | Yes | Number of unique products in link | |
| total_quantity | Yes | Sum of quantities across all products |