Copy a meal
copy_mealCopy food rows from one meal to another meal or day; select specific rows or the whole meal, keeping quantities, products, recipes, and custom nutrition.
Instructions
Copy the food rows of a meal, or only row_ids of it, to another meal and/or day in one write, e.g. 'the same breakfast as yesterday' or 'plan this lunch for tomorrow'. Products and recipes keep their measure and quantity, custom rows their name and nutrition; rows of other types are not copied and are listed in skipped. Returns the copies' row_ids (remove_items with them undoes the copy); data.ok says a re-read shows them all. Each call adds rows unless row_id is reused.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| eaten | No | Sets every copy: true when the user ate it or just asks to log it, false when they plan ahead. Omit it to keep each row's eaten. | |
| row_id | No | Optional UUID version 1 the copies' row_ids are derived from; omit it to get a new one. Repeating the copy with the same row_id and arguments writes the same rows again instead of new ones: when a failed copy's error has a retry_row_id, repeat it with that row_id. Never a row_id from get_day. | |
| row_ids | No | Only these rows of from_meal (row_ids from get_day); omit it for the whole meal. | |
| to_date | Yes | Day to copy to, as YYYY-MM-DD (from_date itself when to_meal differs); when the user says today, yesterday, this week or a weekday, call get_today and count from its date. | |
| to_meal | No | Meal to copy into (default: from_meal). Meal slot. The keys are fixed, but users rename their meals in the app: match the user's words against get_day's meal_name and pass that meal's meal_key. Only the meals get_day lists exist. | |
| 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. | |
| from_meal | Yes | Meal to copy. Meal slot. The keys are fixed, but users rename their meals in the app: match the user's words against get_day's meal_name and pass that meal's meal_key. Only the meals get_day lists exist. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | ||
| data | No | ||
| error | No | describe_error() of what went wrong; docs/AGENTS.md, Results and errors. |