Save batch
metri_save_batchSave one batch: a single preparation the user actually cooked, for example a pot of soup or a tray of lasagna, not a reusable recipe. Without foodId, create a batch from name and components. With foodId, correct that batch: fields you omit keep their values, and every diary item of the batch follows the change. Cooking the dish again is a new batch, not a correction.
Each component is a saved non-batch food by foodId, or an inline food with name and nutritionPer100g. Components replace the whole list, so to change one, read the batch with metri_search_foods by foodId, edit the list and send all of it back.
outputWeightGrams is the finished weight of the whole batch. Pass null when it was not weighed; never estimate it. Without it, the batch can only be logged as a fraction. Changing it keeps the grams of items logged in grams and recomputes their fraction; items logged as a fraction keep their fraction. It cannot be cleared to null while items are logged in grams.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "metri_save_batch"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Batch name. Required when creating a batch. | |
| foodId | No | The batch to correct. Omit to create a batch. | |
| components | No | The complete component list. Required when creating a batch; when correcting, it replaces the whole list and omitting it keeps the current one. | |
| outputWeightGrams | No | Finished weight of the whole batch, or null when it was not weighed. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| foodId | Yes | ||
| warnings | No | ||
| nutritionPer100g | No | ||
| totalBatchNutrition | Yes | ||
| consumedFractionOfBatch | Yes |