update_meal
Update an existing meal. Use only when the current message explicitly changes, corrects, or adds to a meal already logged. Never infer an update from earlier chat history. A plain food statement ("coffee with milk") is a new entry: use log_meal, even if that meal type already exists today.
IMPORTED MEAL ENRICHMENT (Cronometer, Fitbit/Google Health, FatSecret, Apple Health, Health Connect meals):
allowed: explicit macro-only corrections (calories, protein_g, carbs_g, fat_g, alcohol_g), stored as separate, sync-protected enrichments ON THE SAME IMPORTED MEAL; a new provider sync does not overwrite them. omit unchanged macros.
labels: user- or AI-estimated values are labeled estimates, never represented as provider measurements.
never: log_meal to create a duplicate; replace an imported meal's food_items, meal type or date; add/remove its foods, fluids or caffeine. the source app owns those.
FIND THE MEAL: call directly, no preliminary list for an ID or additive totals.
id: when known (list_meals output; the chat history's saved-records note after a log).
else: date (default today) + name and/or target_meal_type to narrow the existing row.
target_meal_type finds by current type and is never written; meal_type sets a new type.
not exactly one match -> nothing changes. multiple matches -> ask the user which meal they mean; never select a candidate id yourself.
send only fields that change.
THREE MODES: add_saved: add_recipe_name appends the recipe's food and ADDS its macros to current totals. match: case-insensitive exact title, then substring; relay no-match/ambiguous errors. stored recipe macros, including 0, are authoritative; explicit macros replace the recipe's contribution only for a correction or changed food/quantity. recipe macros missing -> estimate only the missing fields from the returned food text and retry with the same selector and add_recipe_name. add_unsaved: add_food_items + the four core macros (calories/protein_g/fat_g/carbs_g) for ONLY the new food; estimate them, never ask. text appends; core macros ADD to current totals. alcohol_g: optional, omitted adds nothing. add_both: add_recipe_name + add_food_items; the ordinary core macro fields describe ONLY the unsaved addition, the recipe contributes its stored core macros. correct: both add_* unset; supplied fields REPLACE stored values. send corrected totals, omit unchanged fields. changed food_items -> the four core macros for the WHOLE corrected meal; list_meals only if the needed stored values are unavailable this turn. additions and explicit value corrections need no pre-read. food_items: when supplied, replaces the description even in add modes. SATURATED FAT / FIBER: expanded nutrients, never required for an update. the estimator or a saved recipe's nutrient panel can fill omitted values; core-macro updates work without them. 0 only when known, never a placeholder. ambiguous_add_vs_correct: ask before updating.
ESTIMATE: estimate (same format as log_meal's ESTIMATE section) covers the food this call changes: the add_unsaved/add_both addition's own food, or the WHOLE corrected meal for a correct-mode food_items replacement. never required; omitted -> the server estimates.
MEAL TIME: meal_time sets this meal's local HH:MM clock; null clears an incorrect time; omit to preserve it. move_to_date without a new meal_time clears the old clock: send both when the original eating time is known.
MOVE TO A DIFFERENT DATE -> move_to_date. "move Tuesday's lunch to Wednesday": date/name/target_meal_type only SELECT the meal, they never move it. move_to_date changes the stored date, same id.
REMOVE ONE ADDED COMPONENT -> remove_item_name.
scope: only a food previously recorded on THIS meal (add_recipe_name, add_food_items, or log_meal's own estimated items). none recorded -> throws; use correct mode with corrected totals instead.
estimated item (log_meal's own food, no add_recipe_name/add_food_items involved): has a name and gram estimate but no recorded calorie/macro split, so no precise subtraction -> throws asking for calories/protein_g/fat_g/carbs_g (the meal's corrected TOTALS after removing it) in the SAME call; that call performs the removal and applies those totals together, in that order. do that rather than a separate correcting call.
after removal the meal's nutrient panel is re-estimated from what remains; pass estimate to supply that re-estimate yourself.
DRINKS / HYDRATION WHEN UPDATING: a food update must not silently erase an already-linked hydration event.
unrelated change: omit fluids; existing hydration is preserved.
adding a drink (add_food_items/add_recipe_name): fluids = only the new drink(s); appended.
correcting drinks (both add_* omitted): fluids = the complete corrected drink list; replaces the linked hydration.
correction removes every drink: send fluids: [] explicitly; the linked hydration is deleted.
include any known or reasonably inferable drink volume. drinks only; exclude food moisture.
CAFFEINE / DRINKS WHEN UPDATING: fluids = hydration sidecar, caffeine = caffeine sidecar. a drink change affecting both -> send both in the same update_meal call; omit an unchanged side to preserve its linked data.
adding caffeinated food/drink (add_food_items/add_recipe_name): caffeine = only the new dose(s); appended.
correcting caffeine (both add_* omitted): caffeine = the complete corrected dose list; replaces linked caffeine.
correction removes every dose: send caffeine: [] explicitly.
each retained/new dose: caffeine_mg, optional source_type; dated to the meal date.
SAVE AS RECIPE: user asks to save an already-logged meal as a reusable recipe -> save_as_recipe=true. can be the only action: select the real meal by id or the normal selectors; invent no food or macro edit. "save that as a recipe" after a successful log -> the known meal id + save_as_recipe=true. Never tell the user recipes cannot be saved from chat.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "update_meal"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Meal ID, if known. See FIND THE MEAL. | |
| date | No | YYYY-MM-DD; default today when id and date are both omitted. Only SELECTS the meal (with name and/or target_meal_type); move_to_date changes a stored date. | |
| name | No | Case-insensitive substring of the food description, to pick between meals on the date. Only without id. | |
| fat_g | No | Grams. See THREE MODES. | |
| fluids | No | Drinks in this intake, liquid ingredients of shakes or smoothies included. Omit when no drink amount is known. Stored only when the user enabled hydration tracking. | |
| carbs_g | No | Grams. See THREE MODES. | |
| fiber_g | No | Expanded nutrient: dietary fiber (g). | |
| caffeine | No | Caffeine doses in this intake; each dose is dated to the intake/meal date. | |
| calories | No | kcal, never kJ. See THREE MODES. | |
| estimate | No | The compact 3-line nutrient estimate for the food this call adds or the WHOLE corrected meal on a food_items replacement. Format: see ESTIMATE. Omit and the server estimates; the write is never blocked either way. A block whose parts exceed their whole (saturated fat over fat, fiber over carbs) is discarded and re-estimated. NUTRIENT ID DICTIONARY (id=name, unit = the name's suffix; ug=mcg). Every id means exactly this nutrient, never guess the order: 1=fiber_g 2=sugar_g 3=saturated_fat_g 4=monounsaturated_fat_g 5=polyunsaturated_fat_g 6=trans_fat_g 7=cholesterol_mg 8=sodium_mg 9=potassium_mg 10=calcium_mg 11=iron_mg 12=magnesium_mg 13=phosphorus_mg 14=zinc_mg 15=copper_mg 16=manganese_mg 17=selenium_ug 18=chloride_mg 19=chromium_ug 20=iodine_ug 21=molybdenum_ug 22=vitamin_a_ug 23=vitamin_c_mg 24=vitamin_d_ug 25=vitamin_e_mg 26=vitamin_k_ug 27=thiamin_b1_mg 28=riboflavin_b2_mg 29=niacin_b3_mg 30=pantothenic_acid_b5_mg 31=vitamin_b6_mg 32=biotin_b7_ug 33=folate_b9_ug 34=folic_acid_ug 35=vitamin_b12_ug 36=choline_mg 37=omega3_g 38=omega6_g 39=caffeine_mg 40=water_g 41=starch_g 42=added_sugar_g 43=total_unsaturated_fat_g 44=fluoride_mg | |
| alcohol_g | No | Grams. See THREE MODES. | |
| meal_time | No | Local 24-hour HH:MM this meal was eaten; explicit null clears it. See MEAL TIME. | |
| meal_type | No | New meal type to WRITE (e.g. Snack -> Dinner), only when the user asks to change the type. A "For my breakfast:"-style label at the start of the message is the pill the user had open, not a change request. Never inferred from add_recipe_name. target_meal_type FINDS by current type instead. | |
| protein_g | No | Grams. See THREE MODES. | |
| food_items | No | Replacement food description; omit to preserve or append. See THREE MODES. | |
| user_stated | No | Which of fiber_g and saturated_fat_g the user stated themselves; never list a field for your own estimate. | |
| move_to_date | No | YYYY-MM-DD. Moves this meal to that date, keeping its id. See MOVE TO A DIFFERENT DATE. | |
| add_food_items | No | Unsaved food description to add. See THREE MODES. | |
| recipe_fiber_g | No | add_both: the recipe component's fiber (g). | |
| save_as_recipe | No | true only when the user explicitly asks to save this meal as a reusable recipe, copied from the final persisted meal. See SAVE AS RECIPE. | |
| add_recipe_name | No | Saved recipe name or close phrase to add. See THREE MODES. | |
| saturated_fat_g | No | Expanded nutrient: saturated fat (g). | |
| remove_item_name | No | Name or substring of a previously recorded item to remove. See REMOVE ONE ADDED COMPONENT. exclusive of every other field except the selectors (id/date/name/target_meal_type) and an optional estimate for the remaining meal, UNLESS the tool already refused this exact removal asking for corrected totals: then send calories/protein_g/fat_g/carbs_g with remove_item_name in the retry. | |
| target_meal_type | No | Meal type to FIND on the date ("update today's breakfast" -> "Breakfast"); case-insensitive, only without id. NEVER written: narrows the search like name; meal_type SETS a new type. no meal of this type on the date -> throws naming the types that ARE logged that day, changes nothing, never falls back to another meal. | |
| recipe_saturated_fat_g | No | add_both: the recipe component's saturated fat (g). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes | Human-readable result text returned by the tool. |