Rank foods by a nutrient
get_top_foodsRank foods by their contribution to a chosen nutrient over a date range to show where sugar, salt, or calories came from. Premium only; on forbidden error, tell the user and do not retry.
Instructions
The foods that gave the user the most of a nutrient over a date range, most first: name, amount (kcal for energy, g otherwise, summed over the range) and per100 (the food's own amount per 100 g; null for a custom item). A recipe may be listed as its ingredients. Answers 'where does my sugar come from'. Premium only: on an account without Fitatu Premium, Fitatu refuses it (a forbidden error); tell the user, do not retry.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of hits. | |
| to_date | Yes | Day as YYYY-MM-DD; when the user says today, yesterday, this week or a weekday, call get_today and count from its date. | |
| nutrient | No | What to rank the foods by. | energy |
| from_date | Yes | Day as YYYY-MM-DD; when the user says today, yesterday, this week or a weekday, call get_today and count from its date. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | ||
| data | No | ||
| error | No | describe_error() of what went wrong; docs/AGENTS.md, Results and errors. |