Log food
log_foodLog one or more food items the user ate. Put EACH food as its own item (e.g. chicken, rice and sauce separately) with realistic portions and your best nutrient estimates. Always estimate fiber_g and sugar_g; include sodium_mg/alcohol_g when relevant. Omit a nutrient you can't estimate rather than sending 0. For packaged/branded foods prefer search_food_database + log_food_from_database. PHOTOS WITH A BARCODE: if a photo shows a barcode, read its digits and call lookup_barcode FIRST, then log_food_from_database scaled to the portion; only estimate here when there is no readable barcode or the lookup finds nothing (also use nutrition-label values printed in the photo when visible). THE LABEL WINS: when the photo shows the nutrition label and its numbers differ from the lookup (or the lookup carries a warning, or the user says 'use the label'), log here with the label's values scaled to the portion eaten, and offer save_food so it's right next time. meal_type: use what the user said; if they didn't, omit it and Heza picks it from the local time eaten (breakfast before 11:00, lunch 11-15, snack 15-18, dinner 18-22). The result starts with the user's current local time. Use idempotency_key so retries don't create duplicates. Returns the saved entries and the day's totals vs goals.
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>"
},
"name": "log_food"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | No | Local date YYYY-MM-DD (or 'today'/'yesterday'). Defaults to today in the user's timezone. | |
| items | Yes | ||
| logged_at | No | When it was eaten: HH:MM (local) or ISO datetime. Defaults to now (or noon for past dates). | |
| from_photo | No | True when the estimate comes from a meal photo. | |
| idempotency_key | No | Unique key for this logging request (e.g. a UUID you generate). Re-sending the same key never duplicates entries. |