Skip to main content
Glama
Asquarer02
by Asquarer02

build_meal

Build a meal with one protein, one carb, and one fat that exactly meets your macro targets. Solves portion sizes from a USDA food database, returning ranked meal options.

Instructions

Build meals of one protein, one carb and one fat that hit macro targets exactly.

A deterministic solver, not a guess: it treats the three foods as a 3x3 linear system and solves for the portion of each, scanning every combination in the database. Results whose portions are exact but unrealistic are discarded, and the remainder ranked by how normal the serving sizes look.

Args: target_protein: Target grams of protein for the meal. target_carb: Target grams of carbohydrate. target_fat: Target grams of fat. exclude_tags: Dietary and allergen labels to avoid, matched against each food's "exclude_for", e.g. ["vegan"] or ["gluten", "dairy"]. Call list_available_tags for valid values. tolerance: Only consulted when NO exact fit exists, to decide whether the closest attempt counts as near enough. 0.15 means +/-15% per macro. include_vegetable: Add a low-calorie vegetable side. Its macros are subtracted from the targets before solving, so the totals still land on the targets exactly. max_results: How many ranked meals to return (default 3).

Returns: {"exact_match", "within_tolerance", "tolerance", "meals": [...], "targets", "candidates_evaluated", "message"}.

Each meal carries "items" (each with name, amount, unit and its own macros),
"totals", and "relative_error" per macro. When "exact_match" is true the
totals equal the targets and relative_error is zero.

When no combination fits, "exact_match" and "within_tolerance" are both false,
"meals" holds the single closest attempt, and "message" states how far off it
is. Report that shortfall to the user -- do NOT present it as a successful fit
or adjust the numbers to look closer.

Report the returned amounts and totals verbatim. They are already exact.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toleranceNo
target_fatYes
max_resultsNo
target_carbYes
exclude_tagsNo
target_proteinYes
include_vegetableNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

With no annotations, the description fully discloses the tool's behavior. It explains the deterministic solver approach ('treats the three foods as a 3x3 linear system'), the filtering of unrealistic portions ('portions are exact but unrealistic are discarded'), ranking logic, and tolerance semantics. It also discloses the behavior when no exact fit exists, including the return of the closest attempt and an explicit instruction not to misrepresent results. This is thorough and goes beyond typical annotation coverage.

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?

The description is well-structured with a one-line summary, an 'Args' section, a 'Returns' section, and a usage note. It is concise for the complexity involved, with every sentence contributing meaningful information. The front-loaded purpose sentence and clear headings make it easy to parse.

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?

Given the tool's complexity (7 parameters, algorithm, edge cases), the description is exceptionally complete. It explains the solving approach, parameter behaviors, return schema, and handling of failures. The output schema exists, but the description still enriches it with guidance on reporting results verbatim and not modifying numbers. This is a comprehensive, self-contained description.

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 description coverage is 0%, making the description's parameter explanations essential. The description defines each parameter with practical detail: target macros, exclude_tags (with example), tolerance (with interpretation), include_vegetable (explaining its effect on calculation), and max_results. This adds meaning far beyond the schema's bare titles.

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?

The description clearly states the tool's purpose: 'Build meals of one protein, one carb and one fat that hit macro targets exactly.' It uses a specific verb ('build'), names the resource ('meals'), and specifies the unique constraint (exact macro targets). This distinguishes it from sibling tools like get_food or calculate_macros, which operate on individual foods or calculations.

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?

The description provides strong usage context: it explains when the tool is appropriate (building meals to exact macro targets), references a sibling tool for valid values ('Call list_available_tags for valid values'), and instructs the agent on how to handle unsuccessful fits ('Report that shortfall to the user -- do NOT present it as a successful fit or adjust the numbers to look closer'). This gives explicit guidance on when and how to use the tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Asquarer02/usda-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server