Skip to main content
Glama

Create Food

create_food
Idempotent

Create 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

NameRequiredDescriptionDefault
nameYesThe product name, in English, without the brand.
brandNoThe brand, as printed.
barcodeNoThe barcode digits, if visible.
measuresNoOther household measures, from the label or the user, up to 10.
nutritionYesThe values of the chosen column.
label_textNoThe 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_idYesA new unique string for this action. Reuse it only when retrying the same action.
ingredientsNoIn label order, up to 100 with the nested ones.
label_formatYesus for a US Nutrition Facts panel, eu for every other label.
package_sizeNoThe net weight or volume as printed, like "340 g".
use_estimateNoLeave out unless the user asks for label values only: false saves the label values and skips the estimate.
create_anywayNoSkip 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_gramsNoGrams in one serving, or millilitres for a drink. Required for per_serving.
nutrition_basisYesWhat the values in nutrition are for. A per 100 ml column counts as per_100g.
serving_descriptionNoThe serving as printed, like "1 bar" or "2 tbsp". It names the serving's measure.
servings_per_containerNoAs printed, like "about 9".

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / ingredients / description
      Previous value: -"In label order, up to 100."New value: +"In label order, up to 100 with the nested ones."
    • addedInput schema / properties / ingredients / items / properties / ingredients
      Added value: +{
      +  "description": "What a ready-made ingredient is made of, like the bread in a sandwich: wheat flour, water, salt, yeast. In their order, one level.",
      +  "items": {
      +    "properties": {
      +      "name": {
      +        "description": "The ingredient, in English.",
      +        "type": "string"
      +      },
      +      "original_name": {
      +        "description": "The ingredient as printed, when that isn't in English.",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "name"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
  2. First observed

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With annotations covering only readOnly/idempotent/destructive, the description carries the important behavior: it saves immediately with no preview step, no image leaves the user's side, duplicates and base-food collisions block creation unless create_anyway is set, and long runs return status 'working' with a job_id. It also enumerates every terminal status and what each field means, which is essential given there is no output schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose and usage are front-loaded well, but the definition is very long and the 'Inputs' block restates many fields already documented at 100% schema coverage, in dense run-on sentences. Much of the content earns its place, but it could be cut substantially without losing callable information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 16-parameter, nested-object tool with no output schema, the description closes every major gap: label parsing rules, duplicate and base-food gates, async job handling, and the meaning of each status and its fields. An agent has what it needs to call this correctly and interpret the result.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is already 100%, so the baseline is 3, but the description adds real parsing semantics the schema cannot: values as printed with no calculation or rounding, decimal comma and '<0.5 g' handling, the EU per-100g exception for tiny-serving labels, kJ/kcal never converted or swapped, US Total Carbohydrate with fiber not subtracted, salt vs sodium as printed, English names with original_name for translations, and ready-made ingredients nested one level. That is genuine meaning beyond the field descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb and resource ('Create a packaged food from its nutrition label') plus scope ('as the user's own private food'). It also names the neighboring behaviors it is not (catalog generic food, recipe of catalog foods), so an agent can separate it from create_recipe and log_food without inspecting schemas.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

States explicit when-to-use (packaged product the catalog search doesn't find, label from photo or typed values), explicit when-not (generic or restaurant foods the catalog has, with the alternative named for each), and a ranked fallback for outside-source values. Very little is left to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources