Skip to main content
Glama

Nutrients: proof-backed nutrition data

compute_recipe

Read-only

A recipe's nutrition from its items: total, per serving, per 100 g with cooked_weight_g. Misses carry contribute.

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>"
    },
    "name": "compute_recipe"
  }
}

Input Schema

NameRequiredDescriptionDefault
itemsYes
fieldsNoNutrient keys, e.g. energy, protein
localeNo
regimeNo
servingsNo
cooked_weight_gNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed14 schema fields changed
    • removedInput schema / $schema
      Removed value: -"https://json-schema.org/draft/2020-12/schema"
    • removedInput schema / properties / cooked_weight_g / description
      Removed value: -"Weighed cooked weight of the whole dish. Without it, per_100g is null."
    • removedInput schema / properties / cooked_weight_g / exclusiveMinimum
      Removed value: -0
    • changedInput schema / properties / fields / description
      Previous value: -"Only return these nutrient keys (e.g. [\"energy\",\"protein\"]). Saves tokens. A group name returns every key under it, each as its own value in its own unit, never added or converted: \"vitamin_a\" gives vitamin_a.rae (µg) and vitamin_a.iu (IU); \"carbohydrate\" gives carbohydrate.total (includes fibre), carbohydrate.available (excludes it) and carbohydrate.available_mse. A key that is itself a registry key (e.g. \"fat\") is just that key. A name that matches nothing comes back missing with the closest keys."New value: +"Nutrient keys, e.g. energy, protein"
    • removedInput schema / properties / fields / maxItems
      Removed value: -100
    • removedInput schema / properties / items / description
      Removed value: -"The ingredients: phrases or objects, as nutrition takes them."
    • changedInput schema / properties / items / items / anyOf
      Previous value: -[
      -  {
      -    "description": "A phrase, as resolve takes it: \"2 large eggs\".",
      -    "maxLength": 300,
      -    "minLength": 1,
      -    "type": "string"
      -  },
      -  {
      -    "properties": {
      -      "id": {
      -        "description": "Entity id, e.g. fd_k3m9x2q8vt7w4p (food), pr_ (product), sp_ (supplement), mi_ (menu item), rc_ (recipe). A source id also works: fdc:<USDA fdcId>, ndb:<NDB number>, dsld:<DSLD id>, fndds:<food code>, lnhpd:<LNHPD id>, ciqual:<alim_code>, cnf:<food code>, cofid:<food code>, matvaretabellen:<food id>, slv:<Livsmedelsverket number>.",
      -        "maxLength": 64,
      -        "minLength": 3,
      -        "type": "string"
      -      },
      -      "quantity": {
      -        "description": "Defaults to 1.",
      -        "exclusiveMinimum": 0,
      -        "type": "number"
      -      },
      -      "text": {
      -        "description": "Free text instead of an id, e.g. \"2 large eggs scrambled\". Resolved first.",
      -        "maxLength": 300,
      -        "type": "string"
      -      },
      -      "unit": {
      -        "description": "g, oz, ml, cup, tbsp, serving, slice, capsule... Defaults to \"serving\" for products and supplements, \"g\" with quantity 100 otherwise.",
      -        "maxLength": 32,
      -        "type": "string"
      -      }
      -    },
      -    "type": "object"
      -  }
      -]New value: +[
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "properties": {
      +      "id": {
      +        "type": "string"
      +      },
      +      "quantity": {
      +        "type": "number"
      +      },
      +      "text": {
      +        "type": "string"
      +      },
      +      "unit": {
      +        "type": "string"
      +      }
      +    }
      +  }
      +]
    • removedInput schema / properties / items / maxItems
      Removed value: -100
    • removedInput schema / properties / items / minItems
      Removed value: -1
    • removedInput schema / properties / locale / description
      Removed value: -"BCP 47 locale, e.g. en-US, en-GB, ja-JP. Decides household measure sizes (a US cup is 236.6 ml, a metric cup 250 ml)."
    • removedInput schema / properties / locale / maxLength
      Removed value: -16
    • removedInput schema / properties / regime / description
      Removed value: -"With fields: add values derivable for this regime to every item and the totals (e.g. EU adds salt from sodium), each marked derived_from. Without it, a requested field only sodium can give is null with a reason saying so."
    • removedInput schema / properties / servings / default
      Removed value: -1
    • removedInput schema / properties / servings / exclusiveMinimum
      Removed value: -0
  2. Changed1 schema field changed
    • addedInput schema / properties / regime
      Added value: +{
      +  "description": "With fields: add values derivable for this regime to every item and the totals (e.g. EU adds salt from sodium), each marked derived_from. Without it, a requested field only sodium can give is null with a reason saying so.",
      +  "type": "string"
      +}
  3. Changed1 schema field changed
    • changedInput schema / properties / items / items / anyOf
      Previous value: -[
      -  {
      -    "description": "A phrase, as resolve takes it: \"2 large eggs\".",
      -    "maxLength": 300,
      -    "minLength": 1,
      -    "type": "string"
      -  },
      -  {
      -    "properties": {
      -      "id": {
      -        "description": "Entity id, e.g. fd_k3m9x2q8vt7w4p (food), pr_ (product), sp_ (supplement), mi_ (menu item), rc_ (recipe). A source id also works: fdc:<USDA fdcId>, ndb:<NDB number>, dsld:<DSLD id>, fndds:<food code>.",
      -        "maxLength": 64,
      -        "minLength": 3,
      -        "type": "string"
      -      },
      -      "quantity": {
      -        "description": "Defaults to 1.",
      -        "exclusiveMinimum": 0,
      -        "type": "number"
      -      },
      -      "text": {
      -        "description": "Free text instead of an id, e.g. \"2 large eggs scrambled\". Resolved first.",
      -        "maxLength": 300,
      -        "type": "string"
      -      },
      -      "unit": {
      -        "description": "g, oz, ml, cup, tbsp, serving, slice, capsule... Defaults to \"serving\" for products and supplements, \"g\" with quantity 100 otherwise.",
      -        "maxLength": 32,
      -        "type": "string"
      -      }
      -    },
      -    "type": "object"
      -  }
      -]New value: +[
      +  {
      +    "description": "A phrase, as resolve takes it: \"2 large eggs\".",
      +    "maxLength": 300,
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  {
      +    "properties": {
      +      "id": {
      +        "description": "Entity id, e.g. fd_k3m9x2q8vt7w4p (food), pr_ (product), sp_ (supplement), mi_ (menu item), rc_ (recipe). A source id also works: fdc:<USDA fdcId>, ndb:<NDB number>, dsld:<DSLD id>, fndds:<food code>, lnhpd:<LNHPD id>, ciqual:<alim_code>, cnf:<food code>, cofid:<food code>, matvaretabellen:<food id>, slv:<Livsmedelsverket number>.",
      +        "maxLength": 64,
      +        "minLength": 3,
      +        "type": "string"
      +      },
      +      "quantity": {
      +        "description": "Defaults to 1.",
      +        "exclusiveMinimum": 0,
      +        "type": "number"
      +      },
      +      "text": {
      +        "description": "Free text instead of an id, e.g. \"2 large eggs scrambled\". Resolved first.",
      +        "maxLength": 300,
      +        "type": "string"
      +      },
      +      "unit": {
      +        "description": "g, oz, ml, cup, tbsp, serving, slice, capsule... Defaults to \"serving\" for products and supplements, \"g\" with quantity 100 otherwise.",
      +        "maxLength": 32,
      +        "type": "string"
      +      }
      +    },
      +    "type": "object"
      +  }
      +]
  4. Changed3 schema fields changed
    • addedInput schema / properties / items
      Added value: +{
      +  "description": "The ingredients: phrases or objects, as nutrition takes them.",
      +  "items": {
      +    "anyOf": [
      +      {
      +        "description": "A phrase, as resolve takes it: \"2 large eggs\".",
      +        "maxLength": 300,
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      {
      +        "properties": {
      +          "id": {
      +            "description": "Entity id, e.g. fd_k3m9x2q8vt7w4p (food), pr_ (product), sp_ (supplement), mi_ (menu item), rc_ (recipe). A source id also works: fdc:<USDA fdcId>, ndb:<NDB number>, dsld:<DSLD id>, fndds:<food code>.",
      +            "maxLength": 64,
      +            "minLength": 3,
      +            "type": "string"
      +          },
      +          "quantity": {
      +            "description": "Defaults to 1.",
      +            "exclusiveMinimum": 0,
      +            "type": "number"
      +          },
      +          "text": {
      +            "description": "Free text instead of an id, e.g. \"2 large eggs scrambled\". Resolved first.",
      +            "maxLength": 300,
      +            "type": "string"
      +          },
      +          "unit": {
      +            "description": "g, oz, ml, cup, tbsp, serving, slice, capsule... Defaults to \"serving\" for products and supplements, \"g\" with quantity 100 otherwise.",
      +            "maxLength": 32,
      +            "type": "string"
      +          }
      +        },
      +        "type": "object"
      +      }
      +    ]
      +  },
      +  "maxItems": 100,
      +  "minItems": 1,
      +  "type": "array"
      +}
    • removedInput schema / properties / lines
      Removed value: -{
      -  "items": {
      -    "anyOf": [
      -      {
      -        "maxLength": 300,
      -        "type": "string"
      -      },
      -      {
      -        "properties": {
      -          "id": {
      -            "description": "Entity id, e.g. fd_k3m9x2q8vt7w4p (food), pr_ (product), sp_ (supplement), mi_ (menu item), rc_ (recipe). A source id also works: fdc:<USDA fdcId>, ndb:<NDB number>, dsld:<DSLD id>, fndds:<food code>.",
      -            "maxLength": 64,
      -            "minLength": 3,
      -            "type": "string"
      -          },
      -          "quantity": {
      -            "description": "Defaults to 1.",
      -            "exclusiveMinimum": 0,
      -            "type": "number"
      -          },
      -          "text": {
      -            "description": "Free text instead of an id, e.g. \"2 large eggs scrambled\". Resolved first.",
      -            "maxLength": 300,
      -            "type": "string"
      -          },
      -          "unit": {
      -            "description": "g, oz, ml, cup, tbsp, serving, slice, capsule... Defaults to \"serving\" for products and supplements, \"g\" with quantity 100 otherwise.",
      -            "maxLength": 32,
      -            "type": "string"
      -          }
      -        },
      -        "type": "object"
      -      }
      -    ]
      -  },
      -  "maxItems": 100,
      -  "minItems": 1,
      -  "type": "array"
      -}
    • changedInput schema / required
      Previous value: -[
      -  "lines"
      -]New value: +[
      +  "items"
      +]
  5. First observed

TDQS

C2.9/5.0
Behavior3/5

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

Annotations already establish that this is a safe, closed-world read, so the bar is lower. The description adds real value by disclosing the computed outputs and the cooked_weight_g dependency, but the phrasing 'Misses carry contribute' is ambiguous and no precision/rounding or failure behavior is stated.

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?

Two short sentences with no padding, and the output summary is front-loaded. However the telegraphic style ('Misses carry contribute') sacrifices clarity for brevity and reads as a garbled fragment rather than an explanation.

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

Completeness2/5

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

This is a six-parameter computation with no output schema and very low parameter documentation, so the description should explain the remaining inputs and the shape of the result (e.g. a per-nutrient map). It covers the headline outputs but leaves locale/regime semantics and the meaning of the cryptic 'misses' note unresolved.

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

Parameters3/5

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

Schema coverage is only 17%, so the description carries most of the burden; it does clarify cooked_weight_g (drives per-100 g), 'per serving' (maps to servings) and 'from its items' (the items array). It leaves locale, regime, and the string-vs-object item forms unexplained, so the low-coverage gap is only partly bridged.

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?

'A recipe's nutrition from its items' gives a specific resource plus transformation, and the description names the three outputs (total, per serving, per 100 g). It stops short of distinguishing this from sibling 'nutrition' or 'label' tools, so an agent must infer which one to reach for.

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

Usage Guidelines2/5

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

There is no when-to-use guidance and no mention of alternatives such as 'nutrition' or 'label', even though those siblings clearly overlap. The only usage hints are incidental: 'with cooked_weight_g' implies per-100 g requires that input, and 'Misses carry contribute' is too cryptic to act on.

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