# Log or plan meal

> Logs a meal you ate, or plans one for later.

`WRITE create_meal`

Your assistant uses it when you tell it what you ate, or ask it to plan a meal. It finds each food with [Search foods](https://splot.health/docs/mcp/tools/list-foods) first, and makes a new food only when nothing matches. Photos you attach are saved with the meal.

It takes the same input as [Create a meal](https://splot.health/docs/api/meals/create) in the API, plus `photos`.

## Inputs

| Input | Type | Description |
| --- | --- | --- |
| `eatenAt` | date-time | Required. When it was eaten, or for a plan when it will be, with its UTC offset. |
| `timezone` | string | Required. The IANA timezone where the meal is eaten, such as America/New_York. Up to 100 characters. |
| `items` | array | Required. 1 to 100 items. |
| `state` | string | logged for food eaten; planned only for a plan the person asked to save. One of `planned` or `logged`. Defaults to `logged`. |
| `images` | array | Photos already saved on this record to keep, or public https image links. New photos from the conversation go in photos, never here. Up to 20 items. |
| `name` | string or null | Up to 2,000 characters. |
| `notes` | string or null | Up to 2,000 characters. |
| `photos` | array | Photos the person attached in this conversation to keep with this record: pass the attachments themselves, never file paths. Up to 6 items. |

### Items

| Input | Type | Description |
| --- | --- | --- |
| `food` | object | An existing food: the library and key list_foods returned for it. |
| `newFood` | object | A food that is in neither My foods nor the catalogue. It is saved to My foods so the meal or recipe can point at it. For an estimate, give nutrition per serving (base serving, basisAmount 1) with source origin estimate and a description of what it is based on, and use 1 serving. |
| `quantity` | number or null | How much was eaten, in unit. Leave quantity and unit out only when the person wants an entry without a portion. |
| `unit` | string or null | The food's base unit (g, ml or serving) or one of its measure labels, as list_foods shows them. Convert other units first, such as 1 oz = 28.35 g. Up to 2,000 characters. |

## What your assistant is told

The tool's own instructions, word for word, as every assistant receives them.

> Save a meal the person asked to log or plan. Find each food with list_foods first and pass a match as food (its library and key); use newFood only when nothing matches, never for a product the catalogue has. If the food or portion is unclear, ask one short question first (for example: chicken or bean burrito, and one or two?), without asking again for what the person already said. Use state logged for food eaten, and planned only for a plan the person asked to save, since suggestions alone are not a request. To log a meal that was planned, use update_meal instead of creating another. For planning, read get_targets first and respect the diet, dislikes and allergies the person mentions. Pass photos the person attached as photos. Say the meal is saved only after this returns its id; after an error or timeout, check list_meals for that day before trying again.
