Skip to main content
Glama

openfoodfacts-mcp-server

Compare Food Products Side-by-Side

off_compare_products
Read-onlyIdempotent

Side-by-side nutrition and scoring comparison for 2–10 products by barcode. Returns a normalized table of energy (kcal/100g), fat, saturated fat, sugars, salt, protein, fiber, Nutri-Score, NOVA group, and Green-Score. Designed for "which of these cereals is healthiest?" or "compare these pasta brands" workflows. Missing nutrition data for any product is preserved as absent — comparisons are not imputed. A batch is not all-or-nothing: barcodes that resolve are returned even when others fail, with confirmed-missing barcodes listed in not_found and failed fetches listed separately in failed. Scores carry regional formula caveats. Data under ODbL 1.0 — cite Open Food Facts in downstream use.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
barcodesYes2–10 barcodes to compare, returned as one row each in input order. Example: ["3017620422003", "7622210100146"].

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
errorNoPresent when the call failed. Absent on success.
failedNoBarcodes whose fetch failed, with the per-barcode reason. Absent when every fetch completed. A barcode listed here is unknown, not absent from Open Food Facts — retry it with off_get_product before concluding anything about the product.
productsNoComparison rows in input order — one per barcode whose fetch completed, whether or not a record exists. Barcodes whose fetch failed have no row here; they appear in failed.
not_foundNoBarcodes Open Food Facts answered for, confirming no contributor record exists. Not an error — the product may exist but not yet be entered. Never used for a fetch that failed.
succeededNoNumber of barcodes that resolved to a found product.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous value: -"Machine-readable failure mode. Declared by this tool: `upstream_error`: Open Food Facts returns a 5xx other than 501, serves an HTML error page with a 2xx or 5xx status, or is unreachable — surfaced per barcode in failed[]. `upstream_timeout`: Open Food Facts did not answer within the request deadline — surfaced per barcode in failed[]. `upstream_rejected`: Open Food Facts answers 4xx or 501 Not Implemented for a barcode — surfaced per barcode in failed[]. `rate_limited`: This server's own per-minute request budget is spent, or Open Food Facts answers 429 — surfaced per barcode in failed[]. Other values are possible when a failure originates below the handler."New value: +"Machine-readable failure mode. Declared by this tool: `upstream_error`: Open Food Facts returns a 5xx other than 501 or 504, serves an HTML error page with a 2xx or 5xx status, or is unreachable for a barcode — reported in that barcode's failed entry rather than failing the call. `upstream_timeout`: Open Food Facts did not answer a barcode within the request deadline, or answered 408, 425, or 504 — reported in that barcode's failed entry rather than failing the call. `upstream_rejected`: Open Food Facts refuses a barcode with a 4xx other than 404, 408, 425, or 429, or with 501 Not Implemented — reported in that barcode's failed entry rather than failing the call. `rate_limited`: This server's own per-minute product budget is spent, or Open Food Facts answers 429 — reported in that barcode's failed entry rather than failing the call. Other values are possible when a failure originates below the handler."
  2. Changed5 schema fields changed
    • changedInput schema / properties / barcodes / items / description
      Previous value: -"EAN-13 or UPC barcode (8–14 digits)."New value: +"Product barcode, digits only: 4–40 digits after any leading zeros."
    • changedInput schema / properties / barcodes / items / pattern
      Previous value: -"^\\d{8,14}$"New value: +"^0*[1-9]\\d{3,39}$"
    • changedOutput schema / properties / failed / items / properties / barcode / description
      Previous value: -"EAN-13 or UPC barcode whose fetch failed."New value: +"Barcode whose fetch failed, as provided in input."
    • changedOutput schema / properties / not_found / items / description
      Previous value: -"EAN-13 or UPC barcode with no contributor record."New value: +"Barcode with no contributor record, as provided in input."
    • changedOutput schema / properties / products / items / properties / barcode / description
      Previous value: -"EAN-13 or UPC barcode (same as provided input)."New value: +"Barcode, echoed exactly as provided in input."
  3. Changed3 schema fields changed
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous value: -"Machine-readable failure mode. Declared by this tool: `upstream_error`: Open Food Facts returns 5xx, serves an HTML error page, or is unreachable — surfaced per barcode in failed[] `upstream_timeout`: Open Food Facts did not answer within the request deadline — surfaced per barcode in failed[] `upstream_rejected`: Open Food Facts answers 4xx for a barcode — surfaced per barcode in failed[] `rate_limited`: This server's own per-minute request budget is spent, or Open Food Facts answers 429 — surfaced per barcode in failed[] Other values are possible when a failure originates below the handler."New value: +"Machine-readable failure mode. Declared by this tool: `upstream_error`: Open Food Facts returns a 5xx other than 501, serves an HTML error page with a 2xx or 5xx status, or is unreachable — surfaced per barcode in failed[]. `upstream_timeout`: Open Food Facts did not answer within the request deadline — surfaced per barcode in failed[]. `upstream_rejected`: Open Food Facts answers 4xx or 501 Not Implemented for a barcode — surfaced per barcode in failed[]. `rate_limited`: This server's own per-minute request budget is spent, or Open Food Facts answers 429 — surfaced per barcode in failed[]. Other values are possible when a failure originates below the handler."
    • changedOutput schema / properties / products / items / properties / ecoscore_grade / description
      Previous value: -"Green-Score/Eco-Score (a–e or \"unknown\"). Often absent."New value: +"Green-Score (formerly Eco-Score) environmental impact grade: \"a-plus\" (lowest impact), then \"a\" through \"f\"; \"unknown\" when the data it needs is missing, or \"not-applicable\" for product categories the score does not cover. Often absent."
    • changedOutput schema / properties / products / items / properties / nutriscore_grade / description
      Previous value: -"Nutri-Score letter (a–e). Absent when not computed."New value: +"Nutri-Score grade: \"a\" through \"e\", \"unknown\" when the nutrition data entered is not enough to compute it, or \"not-applicable\" for product categories the score does not cover. Absent when Open Food Facts sent none."
  4. Changed6 schema fields changed
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedInput schema / additionalProperties
      Added value: +false
    • changedOutput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedOutput schema / anyOf
      Added value: +[
      +  {
      +    "not": {
      +      "required": [
      +        "error"
      +      ]
      +    },
      +    "required": [
      +      "products",
      +      "succeeded",
      +      "not_found"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "error"
      +    ]
      +  }
      +]
    • addedOutput schema / properties / error
      Added value: +{
      +  "additionalProperties": {},
      +  "description": "Present when the call failed. Absent on success.",
      +  "properties": {
      +    "code": {
      +      "description": "JSON-RPC error code for this failure.",
      +      "maximum": 9007199254740991,
      +      "minimum": -9007199254740991,
      +      "type": "integer"
      +    },
      +    "data": {
      +      "additionalProperties": {},
      +      "properties": {
      +        "reason": {
      +          "description": "Machine-readable failure mode. Declared by this tool: `upstream_error`: Open Food Facts returns 5xx, serves an HTML error page, or is unreachable — surfaced per barcode in failed[] `upstream_timeout`: Open Food Facts did not answer within the request deadline — surfaced per barcode in failed[] `upstream_rejected`: Open Food Facts answers 4xx for a barcode — surfaced per barcode in failed[] `rate_limited`: This server's own per-minute request budget is spent, or Open Food Facts answers 429 — surfaced per barcode in failed[] Other values are possible when a failure originates below the handler.",
      +          "examples": [
      +            "upstream_error",
      +            "upstream_timeout",
      +            "upstream_rejected",
      +            "rate_limited"
      +          ],
      +          "type": "string"
      +        },
      +        "recovery": {
      +          "additionalProperties": {},
      +          "description": "Actionable next step for the caller.",
      +          "properties": {
      +            "hint": {
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "hint"
      +          ],
      +          "type": "object"
      +        },
      +        "retryable": {
      +          "description": "Whether retrying may succeed.",
      +          "type": "boolean"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "message": {
      +      "description": "Human-readable description of what went wrong.",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "code",
      +    "message"
      +  ],
      +  "type": "object"
      +}
    • removedOutput schema / required
      Removed value: -[
      -  "products",
      -  "succeeded",
      -  "not_found"
      -]
  5. Changed3 schema fields changed
    • addedOutput schema / properties / failed
      Added value: +{
      +  "description": "Barcodes whose fetch failed, with the per-barcode reason. Absent when every fetch completed. A barcode listed here is unknown, not absent from Open Food Facts — retry it with off_get_product before concluding anything about the product.",
      +  "items": {
      +    "additionalProperties": false,
      +    "description": "A single barcode whose fetch failed.",
      +    "properties": {
      +      "barcode": {
      +        "description": "EAN-13 or UPC barcode whose fetch failed.",
      +        "type": "string"
      +      },
      +      "error": {
      +        "description": "What went wrong for this barcode and what to do about it.",
      +        "type": "string"
      +      },
      +      "reason": {
      +        "description": "Declared failure reason — one of upstream_error, upstream_timeout, upstream_rejected, rate_limited.",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "barcode",
      +      "reason",
      +      "error"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • changedOutput schema / properties / not_found / description
      Previous value: -"Barcodes with no contributor record. Not an error — the product may exist but not yet entered in Open Food Facts."New value: +"Barcodes Open Food Facts answered for, confirming no contributor record exists. Not an error — the product may exist but not yet be entered. Never used for a fetch that failed."
    • changedOutput schema / properties / products / description
      Previous value: -"Comparison rows, one per barcode in input order."New value: +"Comparison rows in input order — one per barcode whose fetch completed, whether or not a record exists. Barcodes whose fetch failed have no row here; they appear in failed."
  6. Changed1 schema field changed
    • changedInput schema / properties / barcodes / description
      Previous value: -"2–10 barcodes to compare. All products are fetched in parallel. Example: [\"3017620422003\", \"7622210100146\"]."New value: +"2–10 barcodes to compare, returned as one row each in input order. Example: [\"3017620422003\", \"7622210100146\"]."
  7. First observed

TDQS

Score is being calculated.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.