Skip to main content
Glama
Asquarer02
by Asquarer02

filter_by_diet

Filter the USDA food database to list foods that match a dietary restriction or allergy label like vegan, gluten, or nuts, returning calorie counts and rejecting unknown labels.

Instructions

List every food compatible with one dietary restriction or allergy.

A convenience wrapper over list_foods that excludes any food whose "exclude_for" field contains diet_type.

Args: diet_type: A single dietary or allergen label, e.g. "vegan", "vegetarian", "gluten", "dairy", "shellfish", "nuts", "soy". This must be a value that actually occurs in the data -- call list_available_tags to see the full list. A plausible-sounding but absent label such as "keto" excludes nothing and would silently return the entire database, so unknown labels are rejected instead.

Returns: {"diet_type", "count", "foods": [...]} across all four categories, each food carrying calories_per_unit.

On an unrecognised label: {"error": "unknown_diet_type", "valid_diet_types":
[...]}, so that an excluded-nothing result is never mistaken for a filtered one.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
diet_typeYes

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 carries full burden for behavioral disclosure. It clearly explains the exclusion logic, the rejection of unknown labels, and the exact error format. It even explains the rationale for rejection (to avoid confusing an unfiltered result with a filtered one), giving complete transparency beyond the input schema.

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 clear Args and Returns sections. Every sentence adds value: the purpose, the filtering mechanism, the validation requirement, and the error behavior. It is detailed but not bloated, front-loaded with the main purpose, and easy to scan.

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?

Despite having only one parameter and no annotations, the description fully covers the tool's behavior: what it does, how it filters, what output to expect, and how errors are handled. The return format is explained even though an output schema exists, and the reference to list_available_tags provides necessary external context. No gaps are apparent.

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 coverage is 0%, so the description must fully explain diet_type. It does this thoroughly: defines it as a single dietary/allergen label, provides concrete examples, states the requirement that it must exist in the data, references list_available_tags for the full list, and describes the behavior for absent labels. This adds significant meaning beyond the bare 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?

The description opens with a specific verb+resource: 'List every food compatible with one dietary restriction or allergy.' It explicitly positions itself as a convenience wrapper over list_foods and explains the filtering criterion (exclude_for field contains diet_type), clearly distinguishing it from sibling tools like list_foods and list_available_tags.

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 states when to use this tool ('convenience wrapper over list_foods') and directs the agent to call list_available_tags for valid diet_type values, which is an explicit alternative. It also warns against using invalid labels, effectively saying 'do not use with unverified labels' and explains the consequence (silent full database return). This covers both when and when-not.

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