| name | grocery-api |
| description | Use the local groc HTTP API to search Sainsbury's groceries, search favourites, add/update/remove basket items, and view basket. |
| allowed-tools | Bash(node:skills/api/wrapper.js:*) |
Grocery API Skill
Use this skill when the user asks about Sainsbury's groceries, favourites, searching products, adding/updating/removing basket items, or viewing the basket.
The local API must already be running on port 7876:
GROC_API_PORT=7876 npm run api
Commands
Run from the repo root:
node skills/api/wrapper.js fav-search "milk"
node skills/api/wrapper.js search "milk"
node skills/api/wrapper.js favourites
node skills/api/wrapper.js basket
node skills/api/wrapper.js add <product-id> [qty]
node skills/api/wrapper.js remove <item-id>
node skills/api/wrapper.js update <item-id> <qty>
All commands return JSON from the local API.
Add-to-basket workflow
When the user asks to add an item to the basket:
-
First search favourites:
node skills/api/wrapper.js fav-search "USER ITEM"
-
If there is a clear favourite result that matches the user's intent, add it directly:
node skills/api/wrapper.js add <product-id> [qty]
-
If there are multiple plausible favourite results, ask the user which one to add. Include names, prices, and product IDs.
-
If there are no good favourite matches, or if the user explicitly asks to look outside favourites, use regular search:
node skills/api/wrapper.js search "USER ITEM"
-
For regular search results, always confirm with the user before adding anything to the basket.
-
After adding, show or summarize the basket:
node skills/api/wrapper.js basket
Remove/update workflow
When the user asks to remove or update an item:
-
First inspect the basket to get basket item IDs:
node skills/api/wrapper.js basket
-
Use the basket item_id, not the product ID:
node skills/api/wrapper.js remove <item-id>
node skills/api/wrapper.js update <item-id> <qty>
-
If the item to change is ambiguous, ask the user which basket item they mean.
-
After removing or updating, show or summarize the basket.
Notes
- Prefer favourites over regular search for add requests.
- Do not add ambiguous items without asking.
- Do not use regular search additions without confirmation.
- Use the
product_uid as the product ID for add.
- Use the basket
item_id for remove and update.