Skip to main content
Glama

lookup_barcode

Read-only

Look up a packaged food by its UPC/EAN barcode in Open Food Facts. Returns macros per 100 g, a source label ('Open Food Facts'), and, when known, serving_grams/serving_label for one household serving. All calorie and macro values, including carbohydrates, are estimates from USDA FoodData Central, Open Food Facts, the user's own entry or an AI assistant's estimate — approximate, not lab-measured or specific to a package or batch, and not suitable for insulin dosing (including carb counting for a meal bolus), blood-glucose prediction or any other medical decision.

Input Schema

NameRequiredDescriptionDefault
upcYesUPC/EAN barcode, digits only (8–14 digits).

Output Schema

NameRequiredDescriptionDefault
candidatesYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / properties / candidates / items / properties / provenance / description
      Previous value: -"Chain-menu citation: the chain, its data date, its published page, the assumed build and a caveat."New value: +"Citation: the chain or a product label's brand, its data date, its published page, the assumed build and a caveat."
  2. Changed7 schema fields changed
    • addedOutput schema / properties / candidates / items / properties / provenance
      Added value: +{
      +  "description": "Chain-menu citation: the chain, its data date, its published page, the assumed build and a caveat.",
      +  "properties": {
      +    "as_of": {
      +      "description": "A local date, YYYY-MM-DD.",
      +      "type": "string"
      +    },
      +    "assumed_build": {
      +      "type": "string"
      +    },
      +    "caveat": {
      +      "type": "string"
      +    },
      +    "chain": {
      +      "type": "string"
      +    },
      +    "source_url": {
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "chain",
      +    "as_of"
      +  ],
      +  "type": "object"
      +}
    • addedOutput schema / properties / candidates / items / properties / serving / description
      Added value: +"The basis the macros are for, e.g. '100 g'."
    • addedOutput schema / properties / candidates / items / properties / serving_approx
      Added value: +{
      +  "description": "serving_grams is estimated from a drink's volume.",
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / candidates / items / properties / source / description
      Added value: +"Where the figures came from, as a label."
    • addedOutput schema / properties / candidates / items / properties / source / enum
      Added value: +[
      +  "USDA",
      +  "Open Food Facts",
      +  "Forkmate",
      +  "your entry",
      +  "estimate"
      +]
    • addedOutput schema / properties / candidates / items / properties / unknown_macros
      Added value: +{
      +  "description": "Macros missing from the source data: shown as 0 but unknown, not a real zero.",
      +  "items": {
      +    "enum": [
      +      "protein_g",
      +      "carb_g",
      +      "fat_g"
      +    ],
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • changedOutput schema / properties / candidates / items / required
      Previous value: -[
      -  "name",
      -  "macros",
      -  "source"
      -]New value: +[
      +  "name",
      +  "serving",
      +  "macros",
      +  "source"
      +]
  3. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "candidates": {
      +      "items": {
      +        "description": "A food match. Macros are PER 100 g — scale to the portion before logging.",
      +        "properties": {
      +          "macros": {
      +            "description": "Calories and macros. Estimates, not lab-measured; not for insulin dosing.",
      +            "properties": {
      +              "carb_g": {
      +                "type": "number"
      +              },
      +              "fat_g": {
      +                "type": "number"
      +              },
      +              "kcal": {
      +                "type": "number"
      +              },
      +              "protein_g": {
      +                "type": "number"
      +              }
      +            },
      +            "required": [
      +              "kcal",
      +              "protein_g",
      +              "carb_g",
      +              "fat_g"
      +            ],
      +            "type": "object"
      +          },
      +          "name": {
      +            "type": "string"
      +          },
      +          "serving": {
      +            "type": "string"
      +          },
      +          "serving_grams": {
      +            "type": "number"
      +          },
      +          "serving_label": {
      +            "type": "string"
      +          },
      +          "source": {
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "name",
      +          "macros",
      +          "source"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "required": [
      +    "candidates"
      +  ],
      +  "type": "object"
      +}
  4. First observed

TDQS

A4.1/5.0
Behavior5/5

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

Annotations only cover safety (readOnly, openWorld, non-destructive), but the description goes well beyond them: it names the data provenance chain (USDA FoodData Central, Open Food Facts, user entry, AI estimate), labels values as approximate estimates rather than lab-measured, warns that they may not be package- or batch-specific, and explains what fields are returned including serving_grams/serving_label.

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?

Front-loads purpose, then return contents, then the limitation caveat — a sensible ordering. The final disclaimer is long and runs several distinct warnings together, but every clause is substantive rather than filler.

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?

With an output schema present the description need not enumerate return values, yet it helpfully previews them, and it fully covers the domain-critical caveat about estimate quality. The only gap is not routing the agent to search_foods for cases where a barcode is unavailable or unknown.

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 description coverage is 100% — the single `upc` parameter already documents 'digits only (8–14 digits)'. The description adds the UPC/EAN equivalence but no format, validation, or failure semantics for unknown barcodes, so the baseline 3 is appropriate.

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?

States a specific verb and resource ('look up a packaged food by its UPC/EAN barcode') plus the backing source (Open Food Facts), which is enough for an agent to distinguish it from the name-based search_foods sibling. It never names that alternative explicitly, so the differentiation is inferable rather than stated.

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

Usage Guidelines4/5

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

Implied trigger is clear (you have a barcode), and the description supplies a firm usage boundary: results are not suitable for insulin dosing, carb counting, or blood-glucose prediction. It does not tell the agent when to prefer search_foods instead when no barcode is available, so routing guidance is incomplete.

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.