add_items
Record purchase receipts and item lines into a household inventory, preserve purchase dates, and skip duplicate entries by source reference and line number.
Instructions
Record a purchase (one receipt). Idempotent per (source_ref, line_no).
Each item: {name, quantity, unit, price?, category?, line_no}.
source, and whether purchased_at is required: 'email' a receipt email — REQUIRED, the receipt carries a date 'photo' a photographed receipt — REQUIRED, the paper carries a date 'loyalty' a Clubcard/Nectar export — REQUIRED, the export carries a date 'barcode' scanned in the shop — optional, defaults to today 'manual' typed by the user — optional, defaults to today Only the two "happening right now" doors may default. Dating an old paper receipt or a three-year loyalty export as today would silently corrupt the repurchase intervals that every estimate is derived from.
source_ref: retailer ORDER ID where extractable, else email Message-ID; manual fallback 'manual:::' (+':2' suffix on collision — a nonzero 'ignored' count on a fresh receipt signals one). Call get_stock() first and reuse existing item names exactly. Returns {inserted, ignored, rejected: [{line_no, reason}]}.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"items": "<items>",
"source": "<source>",
"source_ref": "<source_ref>"
},
"name": "add_items"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| items | Yes | ||
| source | Yes | ||
| location | No | ||
| source_ref | Yes | ||
| purchased_at | No |