Skip to main content
Glama

Search USDA Foods

usda_search_foods
Read-only

Search USDA FoodData Central foods by keyword. Returns matching foods with FDC IDs and available preview nutrients: protein (1003), fat (1004), carbohydrate (1005), fiber (1079), and energy (1008, 1062, 2047, 2048), preserving distinct energy estimates. Missing nutrients are omitted. Use the returned fdcId with usda_get_food for other nutrients or the full profile, or usda_compare_foods for side-by-side comparisons. When dataType is omitted, defaults to SR Legacy (common whole foods with complete profiles) — or to Branded when brandOwner is set, since only Branded records carry one. Set dataType to ["Branded"] for packaged products, or include a UPC/GTIN code as the query. Pass brandOwner (e.g. "General Mills") to narrow branded results.

Input Schema

NameRequiredDescriptionDefault
queryYesSearch terms — food name, ingredient, or UPC/GTIN code for branded products. Examples: "chicken breast raw", "banana", "012345678901". FDC reads Lucene syntax: "quoted phrases", +required and -excluded terms, AND/OR/NOT, wildcards (chick*), fuzzy matches (beeef~), boosts (beef^5), grouping parentheses, field:value, regex terms (/chick.*/), and ranges ([a TO c], {a TO c}). Any other slash, bracket, or brace (1/8, w/o, beef [raw]), any unpaired parenthesis, and every double quote when the query holds an odd number of them are sent as literal characters.
dataTypeNoFDC data sources to search. Omitting this defaults to ["SR Legacy"] (common whole foods, complete nutrient profiles), or to ["Branded"] when brandOwner is set. Include "Branded" for packaged products. Multiple values allowed.
pageSizeNoNumber of results per page. Default 10, maximum 50.
brandOwnerNoFilter branded results by brand owner name (e.g. "General Mills", "Kraft"). Only Branded records carry one, so setting this defaults dataType to ["Branded"] unless dataType is given explicitly.
pageNumberNoPage number (1-based). Use with totalPages to paginate. Pages past the end return empty foods with a notice when the query has matches.
foodCategoryNoFilter by USDA food category (e.g. "Poultry Products", "Vegetables and Vegetable Products"). Case-sensitive.

Output Schema

NameRequiredDescriptionDefault
errorNoPresent when the call failed. Absent on success.
foodsNoFoods matching the search query.
noticeNoGuidance for a requested page beyond the available range.
totalHitsNoTotal number of foods matching the query across all pages.
totalCountNoTotal foods matching the query across all pages.
totalPagesNoTotal number of pages available.
currentPageNoCurrent page number (1-based); the requested page for exhausted pages.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changed
    • changedInput schema / properties / pageNumber / description
      Previous value: -"Page number (1-based). Use with totalPages to paginate."New value: +"Page number (1-based). Use with totalPages to paginate. Pages past the end return empty foods with a notice when the query has matches."
    • changedOutput schema / properties / currentPage / description
      Previous value: -"Current page number (1-based)."New value: +"Current page number (1-based); the requested page for exhausted pages."
    • changedOutput schema / properties / foods / items / properties / nutrients / description
      Previous value: -"Preview nutrients per 100g — typically energy, protein, fat, carbs for SR Legacy. Not a complete profile; use usda_get_food for the full set."New value: +"Available preview nutrients per 100g: protein (1003), fat (1004), carbohydrate (1005), fiber (1079), and energy (1008, 1062, 2047, 2048). Source order, values and distinct energy estimates are preserved. Missing entries are omitted; use usda_get_food for other nutrients."
    • changedOutput schema / properties / foods / items / properties / servingSizeUnit / description
      Previous value: -"Unit for servingSize as FDC reports it: mass (\"g\", \"GRM\"), volume (\"ml\", \"MLT\"), or another unit (\"IU\", \"MG\"). Branded only."New value: +"Unit for servingSize as FDC reports it: mass (\"g\", \"GRM\", \"GM\", \"MG\"), volume (\"ml\", \"MLT\"), or another unit (\"IU\"). Branded only."
    • addedOutput schema / properties / notice
      Added value: +{
      +  "description": "Guidance for a requested page beyond the available range.",
      +  "type": "string"
      +}
  2. Changed5 schema fields changed
    • changedInput schema / properties / query / description
      Previous value: -"Search terms — food name, ingredient, or UPC/GTIN code for branded products. Examples: \"chicken breast raw\", \"banana\", \"012345678901\"."New value: +"Search terms — food name, ingredient, or UPC/GTIN code for branded products. Examples: \"chicken breast raw\", \"banana\", \"012345678901\". FDC reads Lucene syntax: \"quoted phrases\", +required and -excluded terms, AND/OR/NOT, wildcards (chick*), fuzzy matches (beeef~), boosts (beef^5), grouping parentheses, field:value, regex terms (/chick.*/), and ranges ([a TO c], {a TO c}). Any other slash, bracket, or brace (1/8, w/o, beef [raw]), any unpaired parenthesis, and every double quote when the query holds an odd number of them are sent as literal characters."
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous value: -"Machine-readable failure mode. Declared by this tool: `query_empty`: The query is empty or contains only whitespace. `no_results`: No foods matched the query in the specified data sources. Other values are possible when a failure originates below the handler."New value: +"Machine-readable failure mode. Declared by this tool: `query_empty`: The query is empty or contains only whitespace. `query_syntax`: FDC rejected the query syntax, e.g. a dangling operator or a trailing backslash. `no_results`: No foods matched the query in the specified data sources. Other values are possible when a failure originates below the handler."
    • changedOutput schema / properties / error / properties / data / properties / reason / examples
      Previous value: -[
      -  "query_empty",
      -  "no_results"
      -]New value: +[
      +  "query_empty",
      +  "query_syntax",
      +  "no_results"
      +]
    • changedOutput schema / properties / foods / items / properties / servingSize / description
      Previous value: -"Serving size in grams from the product label. Branded only."New value: +"Serving size from the product label, in servingSizeUnit. Branded only."
    • changedOutput schema / properties / foods / items / properties / servingSizeUnit / description
      Previous value: -"Unit for servingSize (usually \"g\"). Branded only."New value: +"Unit for servingSize as FDC reports it: mass (\"g\", \"GRM\"), volume (\"ml\", \"MLT\"), or another unit (\"IU\", \"MG\"). Branded only."
  3. 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": [
      +      "totalHits",
      +      "currentPage",
      +      "totalPages",
      +      "foods",
      +      "totalCount"
      +    ]
      +  },
      +  {
      +    "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: `query_empty`: The query is empty or contains only whitespace. `no_results`: No foods matched the query in the specified data sources. Other values are possible when a failure originates below the handler.",
      +          "examples": [
      +            "query_empty",
      +            "no_results"
      +          ],
      +          "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: -[
      -  "totalHits",
      -  "currentPage",
      -  "totalPages",
      -  "foods",
      -  "totalCount"
      -]
  4. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Annotations only declare readOnlyHint and openWorldHint; the description adds real behavioral detail — which nutrients are returned with their IDs, that missing nutrients are omitted, and that distinct energy estimates are preserved rather than collapsed. It also explains the dataType defaulting rule and how it interacts with brandOwner, which is non-obvious. It stops short of mentioning rate limits, error behavior, or result caps beyond pagination.

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-loaded with purpose and return shape, then routing guidance, then filter hints — a sensible order with no filler sentences. It runs a bit long and duplicates schema-level facts about dataType defaults, costing some tightness.

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?

For a six-parameter search tool with an output schema and read-only annotations, the description covers what an agent needs: what is searched, what is returned, what defaults apply, and which sibling to call next. Nothing required for a correct first call is missing.

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%, so the schema already carries parameter meaning, and most of the description's parameter text (dataType defaulting, brandOwner interaction, UPC-as-query) restates the schema verbatim. The one added nuance — that query strings support Lucene syntax and that URLs/slashes/quotes are treated literally — is already fully documented in the query schema description. Baseline 3 is appropriate.

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 ("Search USDA FoodData Central foods by keyword") and immediately scopes what comes back (FDC IDs plus preview nutrients). It also names the sibling tools it is not — usda_get_food for full profiles and usda_compare_foods for side-by-side — so an agent can route without opening a 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 explicit when-to-use guidance: this tool for lookup, usda_get_food when other nutrients or a full profile are needed, usda_compare_foods for comparisons. It also spells out selection rules for the optional filters (set dataType to ["Branded"] for packaged products, pass a UPC/GTIN as the query, use brandOwner to narrow branded results).

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.