Create Food
create_foodCreate a packaged food from its nutrition label, as the user's own private food, so it can be added to the diary. Use when the user wants a packaged product the catalog search doesn't find, with a label from their photo or the values they type. Not for generic or restaurant foods the catalog has: log the catalog's generic food, or build it as a recipe of catalog foods. Values from a trusted outside source (a national food database, USDA, a restaurant's published nutrition) are a last resort, when the catalog has nothing to build the food from. The label is read on the user's side, from their photo or the values they type: no image is sent to Nutriely. The food saves straight away, with no preview step.
Inputs:
Numbers are as printed, in the units the fields name. Values the label doesn't show are left out, not calculated or rounded. The one exception: when an eu label's only column is for a serving of 1 g or less, such as a sweetener tablet, the values are per 100 g with nutrition_basis per_100g. A decimal comma becomes a dot, and "<0.5 g" is 0.5.
nutrition_basis: per_100g when the label has a per 100 g or per 100 ml column, even alongside a per-serving one. Otherwise per_serving, and then serving_grams is required. Only the chosen column's values are sent.
Energy: kJ in energy_kj and kcal in energy_kcal, each as printed, never converted or swapped. Both when both are printed. "Calories" on a US label are kcal.
label_format: us for a US Nutrition Facts panel, eu for every other label.
carbs_g: the carbohydrate line as printed. On a US label that is Total Carbohydrate, with fiber not subtracted.
Salt in salt_g and sodium in sodium_mg, whichever the label prints.
nutrition.other: other printed nutrients, such as vitamins and minerals, with a nutrient code, the printed amount and its unit, not a percentage of daily value. g, mg and µg are converted to what Nutriely keeps. Other units such as IU are refused.
ingredients: in label order, with a percentage only where one is printed, and without allergen notes. For a fried, baked, dried or concentrated product, list them as they are (potato, oil, salt): the estimate accounts for water lost in the making. Product and ingredient names are in English, as in the app, with the brand as printed. A translated ingredient carries the label's wording in original_name. An ingredient that is itself a ready-made food (bread, a tortilla, mayonnaise) lists what it is made of in its own ingredients, as a label does. With no real label, such as a restaurant item or a website, write the ingredients the way a label would, never a menu description: the estimate draws only on plain ingredients.
label_text: the nutrition table as printed, in its own language, up to 10,000 characters. The validator's check runs against it.
serving_description names the serving's measure: "1 scoop" saves a scoop, and "2 tbsp" saves both the 2 tbsp serving and one tbsp.
measures: other household measures the user gives or the label prints, like a tbsp or scoop, each with its grams. Only weights from the label or the user, never guessed. Grams and ounces are always there.
The result's status:
saved: food has the id and measures for the diary. When estimated is true, the values marked estimated were worked out by math from the label and its ingredients, and notes says what the checks found. When estimated is false, the values are the label's own. estimate_quality and estimate_findings say how the label's numbers and its ingredients fit together, and unmatched_ingredients lists the ingredients with no food match, which the estimate can't draw on. A small one late on the label is left out and the estimate still runs: the finding ingredients_left_out names them, and the quality is then strained at best.
duplicate: nothing was created, and foods lists the existing matches. create_anyway creates it anyway, for a product that differs from them.
base_food: nothing was created, because this is plain milk or cheese, which can't be estimated from a label. food is the catalog's generic version, with a full nutrient profile. close is true when its fat and protein are within label tolerance of the label's. create_anyway saves the user's own food instead, with only the label's values.
working: it is still running and will save by itself. job_id identifies it for a status check.
failed: message says why.
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>",
"label_format": "<label_format>",
"nutrition_basis": "<nutrition_basis>",
"nutrition": "<nutrition>",
"request_id": "<request_id>"
},
"name": "create_food"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | The product name, in English, without the brand. | |
| brand | No | The brand, as printed. | |
| barcode | No | The barcode digits, if visible. | |
| measures | No | Other household measures, from the label or the user, up to 10. | |
| nutrition | Yes | The values of the chosen column. | |
| label_text | No | The nutrition table as printed, in its own language, up to 10,000 characters. Send it whenever there is a label: the validator checks against it. | |
| request_id | Yes | A new unique string for this action. Reuse it only when retrying the same action. | |
| ingredients | No | In label order, up to 100 with the nested ones. | |
| label_format | Yes | us for a US Nutrition Facts panel, eu for every other label. | |
| package_size | No | The net weight or volume as printed, like "340 g". | |
| use_estimate | No | Leave out unless the user asks for label values only: false saves the label values and skips the estimate. | |
| create_anyway | No | Skip the duplicate and base food checks. Only when the user says this is a different product from the matches, or wants their own food instead of the base food. | |
| serving_grams | No | Grams in one serving, or millilitres for a drink. Required for per_serving. | |
| nutrition_basis | Yes | What the values in nutrition are for. A per 100 ml column counts as per_100g. | |
| serving_description | No | The serving as printed, like "1 bar" or "2 tbsp". It names the serving's measure. | |
| servings_per_container | No | As printed, like "about 9". |