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
| Name | Required | Description | Default |
|---|---|---|---|
| diet_type | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||