draft_entries
Create a reviewable draft of new food entries or edits and removals to logged entries without writing to the Food Diary, so users can confirm changes first.
Instructions
Propose new Food Entries, and changes to logged ones, without writing to the Food Diary.
Show the Draft to the User.
A Food item uses Food and Serving ids from search_foods. number_of_units is the FatSecret unit count, not necessarily grams: scale it from the Serving's number_of_units. Name it with food_entry_name the way the User said it, in their language, followed by a short note in the same language that it was matched in the US catalog, e.g. "Kajzerka (katalog USA)" or "Kaiser roll (US catalog)". The Draft shows the catalog's name beside it. A Serving of known weight, such as "1 roll (57 g)", is logged as that weight in the Food's Serving in grams or ml when it has one, so the Draft may show that Serving instead.
A Nutrition Label item logs a branded product missing from the catalog as a Stand-in: the closest catalog Food for search_phrase, in the amount whose kcal match the label, under the product's name. Ask for a photo of the Nutrition Label unless the User already gave its values. For a product logged before as a Stand-in, reuse its label from this conversation or your memory, and ask again otherwise. Estimate the label, with estimated=true, only when the User has no packaging. Show the label values, the logged values and the difference. If the User dislikes the Stand-in, draft again with a different search_phrase.
A Diary Entry item logs a Food Entry from the Food Diary again, under its own name, with its Food, Serving and nutrition, so no catalog search is needed. For "the same as yesterday's breakfast", read that Diary Day with get_diary_day, list its Food Entries with their amounts to the User and ask whether everything was the same, or what to leave out or eat more or less of. Then draft the chosen entries by diary_day and food_entry_id, with metric_amount for a changed amount in grams or ml.
A change item changes or removes a Food Entry already in the Food Diary, by diary_day and food_entry_id: change="remove", or change="edit" with a new metric_amount in grams or ml, a meal on the same Diary Day or a food_entry_name. For "undo that" after a confirm_draft, remove the food_entry_ids it returned; undoing a change is a change back. For any other change, read the Diary Day with get_diary_day first, name the entries to change, and ask when it's unclear which one is meant. The Food or Diary Day of an entry can't change: for "chicken thigh, not breast", remove the entry and add a Food item; for "that was yesterday", remove it and add a Diary Entry item with the same food_entry_id, in one Draft whose diary_day is yesterday. Show each change before and after, and the removal_note when there is one.
A Draft holds at most 20 items: split a larger meal into several Drafts.
Include assumptions about estimated amounts. When the Draft has new items, always ask the User whether the suggested Meal is correct. If previous_day_suggested is true, ask whether to use Snacks on the previous Diary Day instead. meal and diary_day are for new items only. A correction needs a new Draft with the explicit Meal or Diary Day. Nothing is written by this tool; a Draft expires after thirty minutes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| meal | No | ||
| items | Yes | At most 20 items. Split a larger meal into several Drafts. | |
| diary_day | No | The Diary Day, as YYYY-MM-DD. Omit for today in the User's timezone. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| meal | Yes | The Meal of the new items; null when the Draft only has changes. | |
| items | Yes | New Food Entries. | |
| totals | Yes | The new items added up. | |
| changes | Yes | Changes to Food Entries, each before and after. | |
| draft_id | Yes | ||
| day_after | Yes | The new items' Diary Day after the whole Draft; null when the Draft only has changes. | |
| diary_day | Yes | The Diary Day of the new items; null when the Draft only has changes. | |
| expires_at | Yes | ||
| attribution | No | Powered by fatsecret Platform API | |
| removal_note | Yes | Set when the Draft removes a Food Entry; tell the User. | |
| meal_suggested | Yes | ||
| other_days_after | Yes | Each other Diary Day the changes are on, after the whole Draft. | |
| previous_day_suggested | Yes |