Read food diary
metri_get_diaryRetrieve the user's diary for whole calendar days, newest entries first. Days are counted in the time zone metri keeps for the user's account, so pass the user's own dates: today, yesterday or this week become a first and a last day. The period may span at most 31 days; split longer periods into consecutive ones. Each entry's consumedAt is local time in that zone, with its UTC offset. Each entry lists its items; an item's grams is the logged amount (a batch item carries fractionOfBatch, plus grams when logged in grams), and serving is how the user counted it (for example 2 cups), so count servings from it rather than from grams. Totals are computed on the server over the whole period regardless of pagination, so use them instead of adding up entries. With query, only entries whose name or any item's food name contains the text are returned, each with all its items; totals then count every item of an entry whose name matches and, in other entries, only the items whose food name matches. Matching is a case-insensitive substring with no synonyms or translation: query each name the user may have logged a food under.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"from": "<from>",
"to": "<to>"
},
"name": "metri_get_diary"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | Last day of the period, included, as YYYY-MM-DD. The same as from for a single day. | |
| from | Yes | First day of the period, as YYYY-MM-DD. | |
| query | No | Case-insensitive substring of an entry name or food name, such as coffee. Narrows both the entries and the totals. | |
| cursor | No | nextCursor from the previous response, to get the next page. Send it with the same from, to and query. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| totals | Yes | ||
| nextCursor | No | ||
| consumptions | Yes |