Save food to My foods
save_foodSave a food to the user's My foods, usually from a photo of its nutrition label, so the label's numbers are used from now on (in the app's search and barcode scanner, and in lookup_barcode). Use it when the user asks to save or fix a food, or offer it after logging from a label because the database numbers were wrong. Convert the label to per 100 g (per 100 ml for drinks, unit 'ml'): a label giving 8.9 g protein per 50 g serve is 17.8 g per 100 g. Prefer the label's own per-100 g column when it has one. Put the label's serving in serving_size_g and serving_label. Include the barcode digits when the photo shows them: the user's version then replaces the shared product for them, and the Heza team gets the correction to fix it for everyone. Saving again with the same barcode (or the same name and brand) updates the user's version. The food stays private to the user. Returns food_id: log a portion with log_food_from_database (food_id + grams).
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": {
"name": "<name>",
"kcal_100g": "<kcal_100g>",
"protein_100g": "<protein_100g>",
"carbs_100g": "<carbs_100g>",
"fat_100g": "<fat_100g>"
},
"name": "save_food"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Product name as on the pack, e.g. 'Manuka Honey Leg Ham' | |
| unit | No | 'ml' for drinks (values per 100 ml), else 'g' (default) | |
| brand | No | ||
| barcode | No | Digits of the barcode, when visible | |
| fat_100g | Yes | ||
| favorite | No | Also star it as a favorite | |
| kcal_100g | Yes | kcal per 100 g/ml (kJ / 4.184 when the label gives kJ) | |
| carbs_100g | Yes | ||
| fiber_100g | No | ||
| sugar_100g | No | ||
| protein_100g | Yes | ||
| serving_label | No | How the label names a serving, e.g. '2 slices (50 g)' | |
| serving_size_g | No | One serving in g (or ml), from the label | |
| sodium_mg_100g | No |