# Save food or recipe

> Saves a food or recipe to My foods, or changes one.

`WRITE save_food`

Your assistant saves a food only when a search finds nothing that matches. A recipe's nutrition is added up from its ingredients. When your assistant changes a packaged product, your copy is saved to My foods and the change goes to Splot for review before it can correct the shared product.

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

## Inputs

| Input | Type | Description |
| --- | --- | --- |
| `name` | string | Required. Up to 200 characters. |
| `data` | object | Required. |
| `brand` | string or null | Up to 200 characters. |
| `barcode` | string or null |  |
| `copyFrom` | object | The food this one was changed from, so its provenance is kept and a product correction can be proposed. |
| `id` | string |  |
| `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. |

## What your assistant is told

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

> Save a food or recipe to My foods, or with id update one of the person's foods. Search list_foods first and save a new food only when nothing matches, never for a product the catalogue already has. Each recipe ingredient is a food from list_foods or, only when nothing matches, a newFood, with a portion; the server adds up the nutrition. When changing a shared or saved food, pass copyFrom so its origin is kept: a product change goes to review and does not change the shared catalogue directly. Meals and recipes keep the version they were saved with. Pass photos the person attached as photos.
