| name | prisma |
| description | Grocery shopping at Prisma Market (prismamarket.ee). Use when the user wants to search for products, build a shopping cart, buy groceries, check out, or manage favorites at Prisma. Supports product search, price comparison, cart validation, direct API ordering, and managing favorites (add/remove/list).
|
| allowed-tools | Bash(*prisma-*.sh*) |
Prisma Market Grocery Shopping
Help the user search for groceries at Prisma Market and order via the API.
All scripts are in the scripts/ directory relative to this file.
Workflow
1. Search for products
prisma-search.sh "<search term>" [limit] [storeId]
- Default limit: 10, store from
.env or arg
- Returns: name, EAN, price, comparison price/unit, category, product URL
Present results as a clear table with name, price, and comparison price so the user can choose.
2. Get product details
prisma-product.sh <ean>
2a. View product image (verify packaging, appearance)
prisma-image.sh <ean1> [ean2] ...
Downloads the product image(s) from Prisma's CDN to /tmp/prisma_images/<ean>.png and prints the path(s). Use this when packaging type matters (e.g. baby food: pouch vs glass jar — same brand often makes both, with no clear indicator in the product name). After running, use the Read tool on the printed path(s) to view the image.
Requires dwebp (brew install webp).
2b. Browse the category tree (traversal)
When keyword search misses items (different naming, brand-specific listings), traverse the catalog by category. Three steps:
Step 1 — list categories (uses Store.navigation GraphQL field):
prisma-categories.sh
prisma-categories.sh <parent-slug>
prisma-categories.sh --tree
The shipped tree has 3 levels (root → L1 → L2). Slugs match the URL path after /tooted/.
Step 2 — list items in a category:
prisma-category.sh <slug> [limit] [from] [storeId]
- Returns
total (full count), items for the requested page, plus from/limit echoed back
- Max ~100 items per call; paginate with
from to fetch the rest
Step 3 — see item details:
prisma-product.sh <ean>
Use the traversal flow when keyword search returns weak hits and you suspect Prisma uses a different product name.
3. List available stores
prisma-stores.sh
4. Validate cart
Before ordering, validate availability and get current prices:
prisma-validate-cart.sh [storeId] <ean1:qty1[:r]> [ean2:qty2[:r]] ...
Returns availability, current/campaign prices, and estimated total. The item
format is identical to order (see substitution note below), so build the item
list once and feed the same string to both validate and order. The :r
(allow-substitution) flag is echoed back as "replace" per item so you can
confirm which items will accept a replacement if out of stock.
5. Authenticate
Authentication credentials and tokens are stored in .env in the project root (gitignored):
PRISMA_STORE_ID=542860184 # default store (Kristiine Prisma)
PRISMA_AUTH_METHOD=smart-id # smart-id | mobile-id | id-card
PRISMA_PERSONAL_CODE=<isikukood> # required for all methods
PRISMA_PHONE=<phone> # required only for mobile-id
PRISMA_TOKEN=<jwt> # set automatically after login
Check if already authenticated: Run prisma-auth.sh check. If valid, skip login.
Automated login flow (when token is missing or expired):
- Run
prisma-auth.sh login to generate Playwright code, then execute it via browser_run_code:
- The script reads credentials from
.env and generates a Playwright snippet that navigates to prismamarket.ee, checks for existing session, clicks through the login flow, fills the form, and submits
- Returns
{ status: 'already_logged_in', token } if session exists, or { status: 'verification_needed', code } with the Smart-ID/Mobiil-ID verification code
- Show the verification code to the user so they can confirm on their device
- Run
prisma-auth.sh login-complete via browser_run_code to wait for the redirect and extract the token
- Returns
{ status: 'success', token }
- Save the token:
prisma-auth.sh set <token>
Other auth commands:
prisma-auth.sh check
prisma-auth.sh decode
prisma-auth.sh clear
6. Checkout via API (home delivery)
This is the primary ordering method — pure API, no browser needed.
6a. List delivery slots
prisma-checkout.sh slots
prisma-checkout.sh slots <YYYY-MM-DD> [postalCode]
6b. Reserve a delivery slot
prisma-checkout.sh reserve <slotId>
Returns { reservationId, expiresAt, slotId }. Reservation expires after 15 minutes.
6c. Place order
prisma-checkout.sh order <reservationId> <slotId> <ean1:qty1> [ean2:qty2] ...
prisma-checkout.sh order <ean1:qty1> [ean2:qty2] ...
- Cart items are sent directly in the API call — no browser cart needed
- Uses
CARD_PAYMENT payment method
- Delivery address, contact info read from
.env
- Returns full order details including orderNumber, orderStatus, cartItems with prices
- Order is created with
paymentStatus: PENDING — use the pay subcommand to complete payment
- Substitution (
replace flag): every item defaults to replace=False — if it's out of stock the picker drops it (the order summary lists it under "Puuduvad tooted" / missing products) rather than substituting. To let the picker swap in an equivalent, append :r to the pair: EAN:qty:r.
- Use
:r for commodity items where any brand is fine — eggs, plain produce (broccoli, bananas, onions), generic frozen veg. These are exactly the items that go out of stock and that you'd happily accept a substitute for.
- Leave it OFF (default) for brand/diet-specific items — anything where a swap could violate a preference: specific milk packaging, a named yogurt/curd brand, clean-ingredient liver pâté, a verified baby-food pouch (vs jar), fragrance-free care products. A silent swap there is worse than a missing item.
- The same
:r format works in prisma-validate-cart.sh, so build the item list once and reuse it.
6d. List saved payment cards
prisma-checkout.sh cards
Returns saved cards with id, type, masked number, expiry, and default status.
6e. Pay for an order with saved card
prisma-checkout.sh pay <orderId>
prisma-checkout.sh pay <orderId> <cardId>
- Outputs Playwright code — run it via
browser_run_code
- For saved cards, payment completes automatically (frictionless 3DS, no user interaction)
- Returns
{ status: 'success', orderId, url } on success
Full end-to-end flow (note :r on the eggs — a commodity item we'd accept a substitute for):
prisma-validate-cart.sh 2060673000002:1 4740012345678:2:r
prisma-auth.sh check
prisma-checkout.sh slots 2026-03-05
prisma-checkout.sh reserve "2026-03-05:uuid-here"
prisma-checkout.sh order "RESERVATION#uuid" "2026-03-05:uuid-here" 2060673000002:1 4740012345678:2:r
prisma-checkout.sh pay "<orderId>"
Additional .env variables for checkout:
PRISMA_FIRST_NAME=Jaan
PRISMA_LAST_NAME=Tamm
PRISMA_PHONE=+37255512345
PRISMA_EMAIL=jaan.tamm@example.com
PRISMA_DELIVERY_ADDRESS="Pärnu mnt 10, 10148 Tallinn"
PRISMA_APARTMENT=42
PRISMA_DRIVER_INFO="3. korrus"
7. Alternative: Populate browser cart only
If the user prefers to review and checkout manually in the browser, use the cart-based flow:
prisma-cart.sh populate [storeId] <ean1:qty1> [ean2:qty2] ...
- Fetches product details for all EANs, builds
ClientCartItem objects, and outputs Playwright code
- Prints a cart summary (items, prices, total) to stderr
- The Playwright code navigates to prismamarket.ee, bypasses cookie consent, writes cart data to
localStorage, and navigates to /kokkuvote
- Run the output via
browser_run_code — returns { success: true, itemCount: N }
- Leave the browser open for the user to review and complete checkout manually
8. Manage favorites
Favorites require authentication (see step 5).
prisma-favorite.sh list
prisma-favorite.sh add <ean>
prisma-favorite.sh remove <ean>
9. Order history
Order history requires authentication (see step 5).
prisma-orders.sh list [limit]
prisma-orders.sh detail <orderId>
prisma-orders.sh items <orderId>
Use order history to vary product selections — check recent orders and avoid re-ordering the same items.
10. Edit a placed order
Edit an existing order that hasn't been picked yet (before the modification deadline). Requires authentication.
prisma-edit-order.sh show <orderId>
prisma-edit-order.sh add <orderId> <ean:qty> [ean:qty...]
prisma-edit-order.sh remove <orderId> <ean> [ean...]
prisma-edit-order.sh set <orderId> <ean:qty> [ean:qty...]
prisma-edit-order.sh replace <orderId> <ean:qty> [ean:qty...]
prisma-edit-order.sh slot <orderId> <newSlotId>
The order must be modifiable (isModifiable: true) — check the modification deadline on the order page. No re-payment is needed; the existing card authorization covers modifications.
To change the delivery slot, use prisma-checkout.sh slots <YYYY-MM-DD> to find the new slotId, then pass it to prisma-edit-order.sh slot. The command reserves the new slot and submits UpdateOrder with the new deliverySlotId + reservationId while keeping all cart items unchanged. The existing card authorization carries over — no re-payment.
Conversational guidelines
- When the user asks to buy something, search for it first and present options
- Always show prices and comparison prices (price per kg/L) to help the user choose
- If a product search returns many results, help the user narrow down
- Default store is configured in
.env (PRISMA_STORE_ID) — ask the user if they want a different store
- Prefer the API checkout flow (step 6) over the browser cart flow (step 7) unless the user specifically asks to use the browser
Order safety rules
- Always validate before ordering: Run
prisma-validate-cart.sh before every order — never skip this step
- Confirm with user: Show the full item list with prices and estimated total, and get explicit confirmation before placing an order
- No duplicate EANs: If the same product appears twice, merge into a single entry with combined quantity
- Track cart state: Keep track of what's been added during the conversation so you can include previous items when the user adds more