Skip to main content
Glama

Update Food

update_food
DestructiveIdempotent

Edit one of the user's foods, the way the app's edit does. Use when the user asks to change a food. A food the user owns keeps its id and its diary entries. The diary is a record, so editing a food doesn't change days already logged; recalculating a day brings it up to date. Send only what changes: anything left out stays as it is. There is no way to delete or replace a food here.

On a packaged food, a nutrient edit changes that value. What can follow from it, such as salt from sodium, is only filled in where the food has none: a value it already has stays as it is, so send each one that changes. An ingredient edit changes only the ingredient list. Neither recalculates the rest of the nutrition. Ingredients sends the whole new list, so include the ones that stay: those keep their amounts unless new ones are sent. serving_grams sets the food's serving measure and changes no nutrient. servings and total_weight_g are only for recipes.

On a recipe, an ingredient edit recalculates the nutrition, so each new ingredient needs a food_measure_id and quantity. Nutrients can't be edited directly on a recipe, because they come from its ingredients.

Each nutrient's value is per the food's base amount, in that nutrient's own unit from the components list. Other units are refused.

A food the user doesn't own, such as a catalog food, is never changed: the edit goes on a private copy, the result gives the copy's food id and the original's id as copied_from, and entries already logged stay on the original.

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": {
      "food_id": "<food_id>",
      "request_id": "<request_id>"
    },
    "name": "update_food"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameNoA new name, in English.
food_idYesThe food to edit.
servingsNoRecipes only: how many servings it makes, a whole number.
nutrientsNoNutrient values to change, on a packaged food.
request_idYesA new unique string for this action. Reuse it only when retrying the same action.
ingredientsNoThe whole new ingredient list, up to 100.
serving_gramsNoPackaged foods only: the grams in one serving. Sets the food's serving measure, and changes no nutrient.
total_weight_gNoRecipes only: the finished weight in grams. Send this or servings, not both.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Beyond the annotations it discloses substantial behavior: partial-update semantics ('send only what changes'), that logged diary days are untouched until recalculated, shortly that an ingredient edit does not recompute other nutrition, that recipe nutrients cannot be edited directly, that foreign units are refused, and that non-owned foods produce a private copy with copied_from. This resolves the tension an agent would otherwise feel with destructiveHint=true by scoping exactly what is and is not modified.

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

Conciseness4/5

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

Purpose and the no-delete boundary are front-loaded, then behavior is organized by packaged-food, recipe, nutrient-units and copy-on-write cases. It is long for a single description and restates the serving_grams rule already present in the schema, plus repeats the 'changes no nutrient' idea, but most sentences carry unique operational 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 an 8-parameter mutation with no output schema, it covers what an agent must know: partial-update vs full-list semantics, packaged vs recipe divergence, unit constraints, and the copy-on-write return shape (copy food id plus copied_from). Nothing material about invoking it correctly appears to be missing.

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 baseline is 3, but the description goes well past it: ingredients is a full replacement list whose unchanged entries keep their amounts, quantities and food_measure_id are required only for new recipe ingredients, serving_grams changes no nutrient, servings/total_weight_g are recipe-only and mutually exclusive, and nutrient values are per base amount in the nutrient's own unit.

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

Purpose4/5

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

The opening sentence gives a specific verb plus resource ('Edit one of the user's foods') and adds an explicit exclusion ('There is no way to delete or replace a food here'), which separates it from delete- or create-style operations. It stops short of naming the sibling it supersedes (create_food), but an agent can still identify the operation from the text alone.

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

Usage Guidelines4/5

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

It states a clear trigger ('Use when the user asks to change a food') and rules out deletion/replacement, which is meaningful boundary guidance. It never points to an alternative tool for out-of-scope cases, so the when-not side is implied rather than routed.

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