Skip to main content
Glama

Log a meal

log_foods
DestructiveIdempotent

Use this when the person has agreed what they ate and wants it logged. Logs one entry per food using the reviewed photo estimates, a saved food or recipe by id and grams, or a named estimate with its serving and nutrients. Logging a saved food by grams can replace its usual portion. A correction to food already logged passes replaces, so the original comes off in the same change. Undo removes the log entries and brings back any replaced. eatenAt null is now. Do not use before they've agreed the foods and amounts, or for a meal they're only planning.

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": {
      "items": "<items>",
      "idempotencyKey": "<idempotencyKey>"
    },
    "name": "log_foods"
  }
}

Input Schema

NameRequiredDescriptionDefault
itemsYesOne entry per food.
eatenAtNoWhen they ate, an ISO date-time; null is now.
replacesNoLogged entries this corrects (their ids, from get_nutrition), taken off in the same change so the original isn't left beside the fix; null adds to the log.
idempotencyKeyYesA new random id for this change (a UUID). Send the same one again only to retry this exact change.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / replaces
      Added value: +{
      +  "anyOf": [
      +    {
      +      "items": {
      +        "type": "string"
      +      },
      +      "maxItems": 30,
      +      "type": "array"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "description": "Logged entries this corrects (their ids, from get_nutrition), taken off in the same change so the original isn't left beside the fix; null adds to the log."
      +}
  2. Changed15 schema fields changed
    • addedInput schema / properties / eatenAt / description
      Added value: +"When they ate, an ISO date-time; null is now."
    • addedInput schema / properties / items / description
      Added value: +"One entry per food."
    • addedInput schema / properties / items / items / properties / carbs / description
      Added value: +"Grams of carbs in one serving, for an estimate only."
    • addedInput schema / properties / items / items / properties / certainty / description
      Added value: +"EXACT for a weighed amount or a label, GOOD for a known food at an amount they gave, ROUGH for an amount guessed from a photo."
    • addedInput schema / properties / items / items / properties / fat / description
      Added value: +"Grams of fat in one serving, for an estimate only."
    • addedInput schema / properties / items / items / properties / foodId / description
      Added value: +"A saved food or recipe's id, from search_foods; null otherwise."
    • addedInput schema / properties / items / items / properties / foodKey / description
      Added value: +"A list food's key (usda:…), from search_foods; null otherwise."
    • addedInput schema / properties / items / items / properties / grams / description
      Added value: +"Grams eaten, with foodId or foodKey."
    • addedInput schema / properties / items / items / properties / kcal / description
      Added value: +"Calories in one serving, for an estimate only."
    • addedInput schema / properties / items / items / properties / name / description
      Added value: +"The food's name, for an estimate only."
    • addedInput schema / properties / items / items / properties / protein / description
      Added value: +"Grams of protein in one serving, for an estimate only."
    • addedInput schema / properties / items / items / properties / quantity / description
      Added value: +"How many servings, for an estimate only."
    • addedInput schema / properties / items / items / properties / serving / description
      Added value: +"One serving in words, such as \"1 cup\", for an estimate only."
    • changedInput schema / properties / items / items / properties / tweaks / anyOf
      Previous value: -[
      -  {
      -    "items": {
      -      "additionalProperties": false,
      -      "properties": {
      -        "foodId": {
      -          "type": "string"
      -        },
      -        "grams": {
      -          "maximum": 5000,
      -          "minimum": 0,
      -          "type": [
      -            "number",
      -            "null"
      -          ]
      -        },
      -        "swapTo": {
      -          "type": [
      -            "string",
      -            "null"
      -          ]
      -        }
      -      },
      -      "required": [
      -        "foodId"
      -      ],
      -      "type": "object"
      -    },
      -    "maxItems": 30,
      -    "minItems": 1,
      -    "type": "array"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "items": {
      +      "additionalProperties": false,
      +      "properties": {
      +        "foodId": {
      +          "description": "One of the recipe's foods, or a food to add (its id or foodKey).",
      +          "type": "string"
      +        },
      +        "grams": {
      +          "description": "Its grams in this meal (0 leaves it out); null with swapTo.",
      +          "maximum": 5000,
      +          "minimum": 0,
      +          "type": [
      +            "number",
      +            "null"
      +          ]
      +        },
      +        "swapTo": {
      +          "description": "Another food's id or foodKey to use in its place; null otherwise.",
      +          "type": [
      +            "string",
      +            "null"
      +          ]
      +        }
      +      },
      +      "required": [
      +        "foodId"
      +      ],
      +      "type": "object"
      +    },
      +    "maxItems": 30,
      +    "minItems": 1,
      +    "type": "array"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • addedInput schema / properties / items / items / properties / tweaks / description
      Added value: +"This meal's changes to a saved recipe; null otherwise."
  3. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations declare destructiveHint=true and idempotentHint=true, but the description adds the semantics that matter: replaces removes the corrected original in the same change, undo restores replaced entries, and logging a saved food by grams overrides its usual portion. These are non-obvious mutation consequences the schema alone does not convey.

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?

Dense and largely front-loaded, with no filler sentences — each covers a distinct concern (entry forms, portion override, correction semantics, undo, timestamp default, exclusions). The one weakness is that the precondition sentence leads before the core purpose statement, slightly delaying what the tool does.

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?

An output schema exists so return values need not be explained, annotations cover safety and idempotency, and the description still fills the remaining gaps: correction/undo behavior, defaults for eatenAt, and the agreement precondition. Nothing an agent needs to invoke this destructive write correctly is missing.

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%, so the baseline is 3; the description goes beyond it by explaining that 'replaces' means the original comes off in the same change and that eatenAt null means now. It does not elaborate on items structure or certainty levels, which the schema already documents.

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?

States a specific verb and resource ('Logs one entry per food') and enumerates the three accepted entry forms (reviewed photo estimates, saved food/recipe by id and grams, named estimate with serving and nutrients). That detail makes it distinguishable from planning or editing siblings without opening the schema.

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?

Gives an explicit precondition ('when the person has agreed what they ate') and explicit exclusions ('Do not use before they've agreed the foods and amounts, or for a meal they're only planning'). Alternatives are identified by condition rather than tool name, which is sufficient to route the agent away from planning flows.

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.