Skip to main content
Glama

Compare USDA Foods

usda_compare_foods
Read-only

Compare nutrients side-by-side for 2–5 foods. Returns a structured table — one row per nutrient, one column per food — formatted as markdown. Best for "spinach vs kale iron" or "which has more protein?" questions. Omit nutrients[] to use the 12 most common defaults (energy, protein, fat, saturated fat, carbs, fiber, sugars, sodium, potassium, calcium, iron, vitamin C); provide nutrients[] with specific FDC IDs to compare different nutrients. All values are scaled to the same gram basis (default 100g). If one or more FDC IDs are not found, the comparison proceeds with the valid foods — only throws too_few_foods when fewer than 2 IDs return data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
unitNoUnit for quantity. Default "g". Does not support "serving" (use a fixed gram basis for consistent comparison).g
fdcIdsYesFDC IDs to compare — 2 to 5 foods. Use usda_search_foods to discover IDs.
quantityNoGram basis for comparison. All values scaled to this amount. Must be positive. Default 100.
nutrientsNoNutrient IDs to include in the comparison. Defaults to the 12 most common: energy (1008), protein (1003), total fat (1004), saturated fat (1258), carbohydrate (1005), fiber (1079), total sugars (2000), sodium (1093), potassium (1092), calcium (1087), iron (1089), vitamin C (1162). Use usda_list_nutrients to look up other IDs.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
basisNoThe common scaling basis applied to all nutrient values.
errorNoPresent when the call failed. Absent on success.
foodsNoThe compared foods, in the same order as the values arrays below.
nutrientsNoNutrient rows — one entry per requested nutrient, with per-food values in the values[] array.
missingDataNoFoods or food+nutrient pairs where data was unavailable. Absent when all data was present.

TDQS

A5/5.0
Behavior5/5

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

Discloses output format (structured markdown table), scalar scaling to a gram basis, default nutrient list, and error handling (fallback behavior with invalid FDC IDs, only throwing too_few_foods). This adds substantial behavioral context beyond the readOnlyHint annotation, fully informing the agent of expected outcomes and edge cases.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two paragraphs of dense but efficient prose, front-loaded with purpose and output format, then usage examples, defaults, scaling, and error behavior. Every sentence adds information, with no filler or repetition.

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 tool with 4 parameters and an output schema, the description covers all essential aspects: purpose, use cases, default behavior, parameter customization, scaling, and error handling. It references sibling tools for ID discovery, leaving nothing an agent needs to call it correctly.

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

Parameters5/5

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

Schema already covers all parameters (100% coverage), but the description adds valuable context: how to omit nutrients to use defaults, which defaults are included (listing them), how to discover FDC IDs (referencing sibling tools), and limitations of the unit parameter (no 'serving'). This enriches parameter understanding beyond the schema.

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?

Clearly states the tool compares nutrients side-by-side for 2–5 foods and returns a markdown table. Distinguishes itself from siblings like usda_get_food (single food retrieval) and usda_search_foods (searching) by focusing on comparison, making the purpose unambiguous.

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?

Provides explicit use cases ('spinach vs kale iron' or 'which has more protein?') and describes behavior when IDs are missing (proceeds with valid foods, throws only when fewer than 2). While it doesn't list exclusions, the sibling tools are clearly different, and the examples make when-to-use obvious.

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.

TDQS

A4.7/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: search for foods, retrieve single or batch nutrient profiles, compare foods side-by-side, and look up nutrient reference data. The descriptions explicitly cross-reference when to use which tool, eliminating ambiguity.

Naming Consistency5/5

All tool names follow a consistent 'usda_<verb>_<noun>' pattern, with verbs like search, get, get, list, compare. Plural/singular usage correctly reflects whether the tool handles one or many items, and the naming is predictable and readable.

Tool Count5/5

Five tools is well-scoped for a USDA food data server, covering search, retrieval (single and batch), comparison, and nutrient metadata lookup. Each tool earning its place with no redundancy or bloat.

Completeness5/5

The tool set fully covers the domain of querying USDA FoodData Central: discovery via search, detailed retrieval via get_food/get_foods, comparison via compare_foods, and reference data via list_nutrients. No obvious gaps exist for read-only access.