Log food
malai_log_foodMALAI: Log food or drink the user says they ate into their MALAI food log, from their own words, e.g. "2 boiled eggs", "a protein shake", "half my chicken rice bowl". Use whenever the user says they ate, drank, or want to log something. Step 1: call with text only; MALAI returns matching options from its food database and the user's saved recipes. Step 2: confirm the right option with the user (or pick the clear best match), then call again with itemId, itemType and amount/unit. Returns what was logged and today's updated protein. Pass requestId on step 2 so a retry never logs twice. The returned entryId identifies the entry.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| meal | No | Meal time, if the user said it. | |
| text | Yes | What the user ate, in their words, e.g. "2 boiled eggs". | |
| unit | No | Unit for amount. Defaults to serving. | |
| amount | No | How much: number of servings, or grams/ml when unit is g/ml. Defaults to 1 serving. | |
| itemId | No | Exact item from an earlier MALAI result (options or logWith). Requires itemType. | |
| itemType | No | Type of itemId. | |
| requestId | No | A unique id you create for this log (e.g. a UUID). Send the same id when retrying so the food is never logged twice. | |
| consumedAt | No | When they ate it, ISO 8601. Defaults to now. | |
| recommendationId | No | Pass through from malai_suggest_next_meal logWith, if logging a suggestion. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | Yes | ||
| entry | No | The logged entry, when logged is true. | |
| query | No | ||
| today | No | ||
| logged | Yes | True when an entry was written. False means choose an option and call again. | |
| message | No | ||
| options | No | Matches to confirm with the user; pass the chosen itemId and itemType back. | |
| instruction | No | ||
| needsChoice | No |