Create a private product
create_foodSave a product from its nutrition label into your own foods to log it by weight or servings. It remains private and never goes to the shared catalog.
Instructions
Save a product in the user's own foods from its nutrition label, e.g. a bar the catalog does not have, to log it by weight or by its servings. Only the user sees it; it never goes to the shared catalog. Values are per 100 g (100 ml with unit ml), as the label gives them: when it gives only a serving's, scale them to 100 g. Energy in kcal, not kJ. Returns food_id and measures, its measures as get_food_measures lists them (null when it could not be read back). Log it with add_food: food_id, food_type PRODUCT, and unit g (ml) with the amount, or a measure_id with the count. Each call creates another product: when one fails with anything but a validation or rate_limit error, look for it with get_my_foods before creating it again.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | The product's name, e.g. 'Baton owsiany'. | |
| unit | No | ml for a drink whose label gives values per 100 ml. | g |
| brand | No | Its brand, if the label has one. | |
| fat_g | Yes | Fat in g in 100 g (100 ml for a drink), as the label gives it. | |
| salt_g | No | Salt in g. | |
| barcode | No | The 8 to 14 digits under the bars. Only the user sees it; find_by_barcode then finds this product. | |
| fiber_g | No | Fibre in g. | |
| servings | No | Its servings, each name once, e.g. [{'name': 'bar', 'weight': 45}]; add_food then logs them by measure_id. | |
| sugars_g | No | Of which sugars, in g; at most carbohydrate_g. | |
| protein_g | Yes | Protein in g in 100 g (100 ml for a drink), as the label gives it. | |
| energy_kcal | Yes | Energy in kcal, not kJ, in 100 g (100 ml for a drink), as the label gives it. | |
| carbohydrate_g | Yes | Carbohydrate in g in 100 g (100 ml for a drink), as the label gives it. | |
| saturated_fat_g | No | Of which saturated fat, in g; at most fat_g. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | ||
| data | No | ||
| error | No | describe_error() of what went wrong; docs/AGENTS.md, Results and errors. |