Skip to main content
Glama
Wellness Project MCP

Wellness Project MCP

log_meal

Records meals and drinks in a food diary, estimates calories and macros, and saves reusable recipes from eaten or prepared foods.

Instructions

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"). For an attached meal photo with <photo_capture_times>, use that photo's local date unless the user explicitly states a different date.

  • meal_time: for an attached meal photo with <photo_capture_times>, send that photo's local HH:MM unless the user explicitly states a different time/date. User-stated timing always wins. Otherwise omit unless the user gave a real clock time.

  • meal_type: when meal_time is supplied, OMIT meal_type unless the user's wording explicitly names or clearly anchors a category; the server assigns the category from meal_time. Without meal_time, for a current-day plain meal/food log omit meal_type and let the server assign it 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 meal_type when the user's wording explicitly names or clearly anchors a category ("breakfast", "for lunch", "post-workout shake"), or when backdating and neither capture time nor another honest clock signal exists.

MACRO SOURCE: strongest evidence wins. Never replace known stored macros with a fresh estimate.

  1. REPEATS (unless a saved recipe is clearly invoked): if 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. If one row unambiguously matches, reuse its stored calories/protein_g/fat_g/carbs_g/alcohol_g and scale by the quantity ratio when the row's quantity is known. If the match or quantity is ambiguous, ask instead of re-estimating. If nothing matches, continue below.

  2. SAVED RECIPES: referenced or selected? YES -> ALWAYS pass recipe_name (saved title) and recipe_multiplier (0.5 for half). Use stored recipe nutrition x portion deterministically; 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.

  3. BRAND NAMES: for a branded, restaurant, or specific product, use published macros for the stated size/variant before a generic estimate.

  4. Otherwise estimate every macro from the food description. Never ask the user for macros.

MACROS: final stored meal must contain calories, protein_g, fat_g and carbs_g. recipe_name supplies stored core values; estimate and pass only missing core values or explicit changes. Without a recipe, pass food_items and those four. No partial core macros or placeholders. Saturated fat and fiber are expanded nutrients, never required for log_meal. Pass saturated_fat_g/fiber_g only when already known from strong evidence; otherwise omit them. When expanded nutrient tracking is enabled, the gated nutrient estimator can fill them; when disabled they remain unset. 0 is a real value only when the food truly contains none of that nutrient. Ask only if food_items are absent and no recipe_name applies.

FASTING: if the user ate nothing / fasted all day, log one "Fast day" Snack with every macro 0.

ESTIMATE: pass a compact 3-line block estimating every one of the app's undefined tracked nutrients for the food, in exactly this format, no prose before or after: items::|:|... macros:;<protein_g>;<carbs_g>;<fat_g>;<alcohol_g> nutrients:1:;2:;...;undefined: Estimate all undefined nutrients. Always return all undefined IDs. Never omit one because you are uncertain -- use your best reasonable estimate from the likely food, quantity, ingredients, preparation and comparable foods; 0 only when a nutrient is reasonably expected to be negligible. Which id is which nutrient, and its unit, is the dictionary on the estimate param. Omit for an unchanged saved recipe; with added_food_items, estimate that addition only. Otherwise supply when available; the server estimates missing values.

DUPLICATES: if this tool returns a duplicate error, tell the user what's already logged and ask whether this is a separate serving (retry with force=true) or should update the existing entry instead (update_meal with adjusted values).

DRINKS / HYDRATION: this is the single write path for consumed drinks too. Known or reasonably inferable drink volume (tea, coffee, milk, juice, shakes, smoothies, etc.) → always report fluids, even if also contributes calories/macros/alcohol. Food moisture → omit. The server decides whether hydration tracking is enabled; never use a separate hydration write tool. A plain fluid-only intake may omit food_items and macros and send only fluids. For alcoholic drinks, include that drink's alcohol_g in its fluid item; if there is exactly one drink, the top-level alcohol_g can stand in.

CAFFEINE / DRINKS: this is the single assistant write path for caffeine too. Drinks only; exclude food moisture. When the user consumed a drink and its volume is known or reasonably inferable, include it in fluids so hydration is recorded; if the drink is caffeinated, include caffeine in the same call too. Do not leave a known-volume drink only in food_items. Each caffeine item needs caffeine_mg and may optionally include source_type. The date comes from the intake date. Preserve exact user-provided milligrams; for vague coffee/tea/energy-drink/pre-workout descriptions, estimate caffeine with the same nutrition-estimation judgment used for meal macros. Never use separate hydration or caffeine write tools. A 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

NameRequiredDescriptionDefault
dateNoYYYY-MM-DD. Omit for today (the server resolves it in the user's own timezone, more reliable than guessing). Send explicitly for any past date.
fat_gNoFat in grams. See MACROS above.
forceNoTrue only when the user has explicitly confirmed a separate entry despite a duplicate warning. Bypasses duplicate detection.
fluidsNoOptional drinks consumed in this intake, including liquid ingredients in shakes or smoothies. Omit when no drink amount is known. Hydration is persisted only when the user enabled hydration tracking.
carbs_gNoCarbohydrates in grams. See MACROS above.
fiber_gNoDietary fiber in grams. See MACROS above.
caffeineNoOptional caffeine doses in this intake. Keep each dose simple: caffeine amount is required and type is optional. The dose date follows the intake/meal date. If the user gave exact milligrams, preserve them exactly; otherwise estimate from the described food or drink.
caloriesNoTotal calories(kcal) never kJ
estimateNoThe compact 3-line nutrient estimate for this meal. See ESTIMATE above for the format. Omit to have the server estimate instead -- never blocks the write 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 is the name's suffix; ug=mcg). Every id means exactly this nutrient, never guess the order: undefined
alcohol_gNoAlcohol in grams (not kcal). Only if alcoholic drinks were consumed; unset takes the saved recipe's value when recipe_name matches. 1 standard drink is about 14g.
meal_timeNoOptional local 24-hour HH:MM time. For an attached meal photo, use the current turn's photo capture time when the user did not state a different date/time. User-stated timing always wins.
meal_typeNoOptional. Omit for a current-day plain meal/food log so the server assigns the category from the user's resolved local clock. Send only when the user explicitly names or clearly anchors a category, or when backdating and the current clock cannot apply. A saved recipe's stored meal type never fills this in.
protein_gNoProtein in grams. See MACROS above.
food_itemsNoDescription of the food and drinks consumed. See MACROS above; ask the user only if completely absent and no recipe_name applies.
recipe_nameNoSaved recipe title only, without portion words or additions. See SAVED RECIPES above.
recipe_onlyNotrue=save recipe only and write no food_log row. Requires save_as_recipe=true. See RECIPE SAVE above.
user_statedNoWhich of fiber_g and saturated_fat_g the user said themselves; list a field only when the user stated the number, never for your own estimate.
recipe_titleNoRecipe name when recipe_only=true. See RECIPE SAVE above.
save_as_recipeNoTrue only when the user explicitly asks to save a reusable recipe. recipe_only=true saves recipe only; otherwise the final persisted meal is saved after the log succeeds. See RECIPE SAVE above.
recipe_servingsNoWhole-batch serving count when recipe_only=true; default=1. See RECIPE SAVE above.
saturated_fat_gNoSaturated fat in grams. See MACROS above.
added_food_itemsNoOnly food added to a saved recipe; supply final combined macros. Omit when none.
recipe_multiplierNoPortions of the matched saved recipe; default 1, e.g. 0.5 for half.

Output Schema

NameRequiredDescriptionDefault
resultYesHuman-readable result text returned by the tool.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed23 schema fields changedv1.3.0
    • addedInput schema / properties / added_food_items
      Added value: +{
      +  "description": "Only food added to a saved recipe; supply final combined macros. Omit when none.",
      +  "type": "string"
      +}
    • addedInput schema / properties / caffeine
      Added value: +{
      +  "description": "Optional caffeine doses in this intake. Keep each dose simple: caffeine amount is required and type is optional. The dose date follows the intake/meal date. If the user gave exact milligrams, preserve them exactly; otherwise estimate from the described food or drink.",
      +  "items": {
      +    "properties": {
      +      "caffeine_mg": {
      +        "description": "Caffeine in milligrams. Preserve an explicit user amount exactly; otherwise estimate from the described intake.",
      +        "type": "number"
      +      },
      +      "source_type": {
      +        "description": "Optional broad caffeine type.",
      +        "enum": [
      +          "coffee",
      +          "espresso",
      +          "tea",
      +          "energy_drink",
      +          "soda",
      +          "pre_workout",
      +          "supplement",
      +          "other"
      +        ],
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "caffeine_mg"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • changedInput schema / properties / calories / description
      Previous value: -"Total calories (kcal). See MACROS above."New value: +"Total calories(kcal) never kJ"
    • addedInput schema / properties / estimate
      Added value: +{
      +  "description": "The compact 3-line nutrient estimate for this meal. See ESTIMATE above for the format. Omit to have the server estimate instead -- never blocks the write either way. A block whose parts exceed their whole (saturated fat over fat, fiber over carbs) is discarded and re-estimated.\n\nNUTRIENT ID DICTIONARY (id=name, unit is the name's suffix; ug=mcg). Every id means exactly this nutrient, never guess the order:\nundefined",
      +  "type": "string"
      +}
    • addedInput schema / properties / fiber_g
      Added value: +{
      +  "description": "Dietary fiber in grams. See MACROS above.",
      +  "type": "number"
      +}
    • changedInput schema / properties / fluids / description
      Previous value: -"Optional drinks consumed in this intake. Omit when no drink amount is known. Hydration is persisted only when the user enabled hydration tracking."New value: +"Optional drinks consumed in this intake, including liquid ingredients in shakes or smoothies. Omit when no drink amount is known. Hydration is persisted only when the user enabled hydration tracking."
    • changedInput schema / properties / fluids / items / properties / beverage_type / description
      Previous value: -"Broad drink type. Default water. Use other when the exact drink is not in the enum and preserve its name in beverage_name."New value: +"Broad drink type. Default water. Energy drinks are accepted and stored as other; preserve the exact drink in beverage_name."
    • changedInput schema / properties / fluids / items / properties / beverage_type / enum
      Previous value: -[
      -  "water",
      -  "electrolyte",
      -  "sports_drink",
      -  "coffee",
      -  "tea",
      -  "juice",
      -  "milk",
      -  "soda",
      -  "broth",
      -  "other"
      -]New value: +[
      +  "water",
      +  "electrolyte",
      +  "sports_drink",
      +  "coffee",
      +  "tea",
      +  "juice",
      +  "milk",
      +  "soda",
      +  "broth",
      +  "other",
      +  "energy_drink"
      +]
    • removedInput schema / properties / fluids / items / properties / unit
      Removed value: -{
      -  "description": "Volume unit. Default ml.",
      -  "enum": [
      -    "ml",
      -    "fl_oz"
      -  ],
      -  "type": "string"
      -}
    • removedInput schema / properties / fluids / items / properties / volume
      Removed value: -{
      -  "description": "Consumed drink volume in the supplied unit.",
      -  "type": "number"
      -}
    • addedInput schema / properties / fluids / items / properties / volume_ml
      Added value: +{
      +  "description": "Millilitres. Convert any other unit first.",
      +  "type": "number"
      +}
    • changedInput schema / properties / fluids / items / required
      Previous value: -[
      -  "volume"
      -]New value: +[
      +  "volume_ml"
      +]
    • addedInput schema / properties / meal_time
      Added value: +{
      +  "description": "Optional local 24-hour HH:MM time. For an attached meal photo, use the current turn's photo capture time when the user did not state a different date/time. User-stated timing always wins.",
      +  "type": "string"
      +}
    • changedInput schema / properties / meal_type / description
      Previous value: -"Required. Infer from time of day or context, even when recipe_name is used (a saved recipe's own stored meal type never fills this in)."New value: +"Optional. Omit for a current-day plain meal/food log so the server assigns the category from the user's resolved local clock. Send only when the user explicitly names or clearly anchors a category, or when backdating and the current clock cannot apply. A saved recipe's stored meal type never fills this in."
    • addedInput schema / properties / recipe_multiplier
      Added value: +{
      +  "description": "Portions of the matched saved recipe; default 1, e.g. 0.5 for half.",
      +  "type": "number"
      +}
    • changedInput schema / properties / recipe_name / description
      Previous value: -"Name or close phrase for one of the user's saved recipes, e.g. \"protein oats\", \"chicken bowl\", or \"breakfast\" for their saved Breakfast recipe. See SAVED RECIPES above."New value: +"Saved recipe title only, without portion words or additions. See SAVED RECIPES above."
    • addedInput schema / properties / recipe_only
      Added value: +{
      +  "description": "true=save recipe only and write no food_log row. Requires save_as_recipe=true. See RECIPE SAVE above.",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / recipe_servings
      Added value: +{
      +  "description": "Whole-batch serving count when recipe_only=true; default=1. See RECIPE SAVE above.",
      +  "type": "number"
      +}
    • addedInput schema / properties / recipe_title
      Added value: +{
      +  "description": "Recipe name when recipe_only=true. See RECIPE SAVE above.",
      +  "type": "string"
      +}
    • addedInput schema / properties / saturated_fat_g
      Added value: +{
      +  "description": "Saturated fat in grams. See MACROS above.",
      +  "type": "number"
      +}
    • addedInput schema / properties / save_as_recipe
      Added value: +{
      +  "description": "True only when the user explicitly asks to save a reusable recipe. recipe_only=true saves recipe only; otherwise the final persisted meal is saved after the log succeeds. See RECIPE SAVE above.",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / user_stated
      Added value: +{
      +  "description": "Which of fiber_g and saturated_fat_g the user said themselves; list a field only when the user stated the number, never for your own estimate.",
      +  "items": {
      +    "enum": [
      +      "fiber_g",
      +      "saturated_fat_g"
      +    ],
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • removedInput schema / required
      Removed value: -[
      -  "meal_type"
      -]
  2. First observedv1.2.1

TDQS

A4.3/5.0
Behavior5/5

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

Annotations (readOnly=false, destructive=false, idempotent=false) are minimal; the description carries the rest and does so extensively: duplicate detection and its bypass, server-side meal_type assignment from local clock, hydration persisted only when the user enabled tracking, inconsistent estimate blocks being discarded and re-estimated, and the requirement that a stored meal contain all four core macros. These are real behavioral traits an agent could not deduce from the schema or annotations.

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?

Length is largely earned by a 23-parameter tool with heavy conditional logic, and section headers make the policy scannable. However it is not front-loaded -- the purpose sentence appears after the RECIPE SAVE block -- and the DRINKS/HYDRATION and CAFFEINE/DRINKS sections repeat the same "never use a separate hydration or caffeine write tool" instruction nearly verbatim.

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

Completeness4/5

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

For a tool this complex, with an output schema and annotations already covering the safety profile, the description covers the hard cases: repeats, saved recipes, brand macros, fasts, duplicates, fluids, caffeine. The one material hole is that the referenced nutrient ID dictionary does not resolve, so the mandatory ESTIMATE block format is under-specified despite being called out as required.

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

Parameters4/5

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

Schema coverage is 100%, but the schema entries are mostly pointers ("See MACROS above", "See RECIPE SAVE above"), so the description genuinely supplies the conditional invariants -- recipe_only=true requires save_as_recipe=true plus recipe_title and whole-batch inputs, meal_type must be omitted when meal_time is supplied. It falls short on the estimate parameter: the description says the nutrient ID dictionary lives on that param, but the param text renders only "undefined", leaving the ids:<...>/macros:<...>/nutrients:1:<value> format unusable in practice.

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 description states a specific verb and resource -- "Log a meal to the user's food diary" -- and scopes it ("use: logging request or concrete meal consumed. question/habit/hypothetical alone: no write"). It also differentiates from siblings by naming list_meals, update_meal, and the separate hydration/caffeine write tools it replaces. It loses a point because the actual purpose statement is buried after a long RECIPE SAVE block, so the first thing read is a conditional sub-mode rather than what the tool does.

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?

Explicit when-to-use and when-not-to-use: a logging request or concrete meal consumed writes, while a question, habit, or hypothetical does not. It also routes agents to alternatives -- list_meals before estimating repeats, update_meal when a duplicate should be adjusted, force=true only on explicit user confirmation of a separate serving. Nothing about selecting this tool 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.