log_meal
RECIPE SAVE: intent=create/save recipe not eaten -> save_as_recipe=true, recipe_only=true intent=log eaten meal + save recipe -> save_as_recipe=true, recipe_only=false/omit recipe_only=true -> food_log_write=false; save_as_recipe must be true recipe_only=true -> recipe_title= recipe_only=true -> recipe_servings=<whole-batch servings; default 1> recipe_only=true -> food_items= recipe_only=true -> calories/protein_g/fat_g/carbs_g=<WHOLE-BATCH totals; estimate, never ask> recipe_only=true -> estimate=
Log a meal to the user's food diary. use: logging request or concrete meal consumed. question/habit/hypothetical alone: no write.
INFER:
date: today, or from context ("yesterday", "last night"). attached meal photo with <photo_capture_times> -> that photo's local date, unless the user explicitly states another.
meal_time: attached meal photo with <photo_capture_times> -> that photo's local HH:MM, unless the user explicitly states another time/date; user-stated timing always wins. else omit unless the user gave a real clock time.
meal_type: OMIT by default; the server assigns it from meal_time, or for a current-day plain meal/food log from the user's resolved local clock (00:00-04:00 Snack, 04:00-10:30 Breakfast, 10:30-15:00 Lunch, 15:00-17:00 Snack, 17:00-21:30 Dinner, 21:30-24:00 Snack). send only when the wording explicitly names or clearly anchors a category ("breakfast", "for lunch", "post-workout shake"), or when backdating with neither a capture time nor another honest clock signal.
MACRO SOURCE: strongest evidence wins. Never replace known stored macros with a fresh estimate.
REPEATS (unless a saved recipe is clearly invoked): the user refers to a previously logged item ("same", "another", "more", "again", or equivalent in any language), OR names a food plausibly matching a recent log even without a repeat keyword (e.g. "two eggs") -> call list_meals for the referenced/recent date range BEFORE estimating. one row unambiguously matches -> reuse its stored calories/protein_g/fat_g/carbs_g/alcohol_g, scaled by the quantity ratio when the row's quantity is known. match or quantity ambiguous -> ask instead of re-estimating. no match -> continue below.
SAVED RECIPES: referenced or selected -> ALWAYS recipe_name (saved title) + recipe_multiplier (0.5 = half). stored recipe nutrition x portion is deterministic; estimate only missing values or added_food_items, and sum additions with the recipe portion. NEVER log a referenced recipe as a generic food_items estimate.
BRAND NAMES: branded, restaurant or specific product -> published macros for the stated size/variant before a generic estimate.
else: estimate every macro from the food description. Never ask the user for macros.
MACROS:
stored meal must contain calories, protein_g, fat_g, carbs_g. no partial core macros, no placeholders.
recipe_name: supplies stored core values; pass only missing core values or explicit changes.
no recipe: food_items + all four.
saturated_fat_g/fiber_g: expanded nutrients, never required. pass only when known from strong evidence, else omit (the gated nutrient estimator fills them when expanded nutrient tracking is on; otherwise they stay unset).
0: a real value only when the food truly contains none of that nutrient.
ask: only if food_items is absent and no recipe_name applies.
FASTING: user ate nothing / fasted all day -> one "Fast day" Snack, every macro 0.
ESTIMATE: compact 3-line block estimating every one of the app's 44 tracked nutrients for the food, exactly this format, no prose before or after: items::|:|... macros:;<protein_g>;<carbs_g>;<fat_g>;<alcohol_g> nutrients:1:;2:;...;44:
always all 44 ids; never omit one for uncertainty: best reasonable estimate from the likely food, quantity, ingredients, preparation and comparable foods. 0 only when the nutrient is reasonably expected to be negligible.
id -> nutrient and unit: the dictionary on the estimate param.
omit: unchanged saved recipe. added_food_items: estimate that addition only. else supply when available; the server estimates missing values.
DUPLICATES: duplicate error -> tell the user what is already logged and ask: separate serving (retry with force=true), or update the existing entry (update_meal with adjusted values)?
DRINKS / HYDRATION: this is the single write path for consumed drinks too; never use a separate hydration write tool (the server decides whether hydration tracking is on).
known or reasonably inferable drink volume (tea, coffee, milk, juice, shakes, smoothies, etc.) -> always in fluids, even when the drink also contributes calories/macros/alcohol. food moisture -> omit.
plain fluid-only intake: may omit food_items and macros.
alcoholic drinks: each drink's alcohol_g on its fluid item; exactly one drink -> the top-level alcohol_g can stand in.
CAFFEINE / DRINKS: this is the single assistant write path for caffeine too; never use separate hydration or caffeine write tools.
consumed drink with known or reasonably inferable volume -> in fluids so hydration is recorded, never only in food_items; caffeinated -> caffeine in the same call too. drinks only; exclude food moisture.
each caffeine item: caffeine_mg, optional source_type; dated to the intake date.
user-stated milligrams: keep exact. vague coffee/tea/energy-drink/pre-workout descriptions: estimate with the same judgment used for meal macros.
drink-only or caffeine-only intake: may omit food_items/macros.
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": "log_meal"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | No | YYYY-MM-DD. Omit for today: the server resolves it in the user's own timezone, more reliable than guessing. Always send a past date explicitly. | |
| fat_g | No | Grams. See MACROS. | |
| force | No | true only after the user explicitly confirmed a separate entry despite a duplicate warning; bypasses duplicate detection. | |
| 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 MACROS. | |
| fiber_g | No | Grams. See MACROS. | |
| caffeine | No | Caffeine doses in this intake; each dose is dated to the intake/meal date. | |
| calories | No | Total kcal, never kJ. | |
| estimate | No | The compact 3-line nutrient estimate for this meal. 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 of alcohol, not kcal; 1 standard drink is about 14g. Only when alcoholic drinks were consumed; unset takes the saved recipe's value when recipe_name matches. | |
| meal_time | No | Local 24-hour HH:MM. A photo capture time counts only from the current turn's photo. See INFER. | |
| meal_type | No | See INFER. A saved recipe's stored meal type never fills this in. | |
| protein_g | No | Grams. See MACROS. | |
| food_items | No | The food and drinks consumed. See MACROS. | |
| recipe_name | No | Saved recipe title only, no portion words or additions. See SAVED RECIPES. | |
| recipe_only | No | true = save the recipe only, no food_log row. Needs save_as_recipe=true. See RECIPE SAVE. | |
| user_stated | No | Which of fiber_g and saturated_fat_g the user stated themselves; never list a field for your own estimate. | |
| recipe_title | No | Recipe name when recipe_only=true. | |
| save_as_recipe | No | true only when the user explicitly asks to save a reusable recipe. recipe_only=true saves the recipe only; otherwise the final persisted meal is saved after the log succeeds. See RECIPE SAVE. | |
| recipe_servings | No | Whole-batch serving count when recipe_only=true; default 1. | |
| saturated_fat_g | No | Grams. See MACROS. | |
| added_food_items | No | Only food added to a saved recipe; supply final combined macros. Omit when none. | |
| recipe_multiplier | No | Portions of the matched saved recipe; default 1, e.g. 0.5 for half. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes | Human-readable result text returned by the tool. |