upsert_and_log
Find a custom food or create it if missing, then log it to your Garmin diary with the provided nutrition data, eliminating duplicates and extra steps.
Instructions
Find-or-create a custom food then log it in one step
Searches the user's custom food library for food_name. If found, logs it immediately. If not found, creates it with the provided nutrition data and then logs it. This avoids duplicate food entries and removes the need for separate search → create → log round-trips.
Args: meal_date: Date in YYYY-MM-DD format meal_time: Time in HH:MM:SS format (account timezone); used to determine the meal automatically food_name: Name of the food to find or create calories: Calories per serving carbs: Carbohydrates in grams per serving protein: Protein in grams per serving fat: Total fat in grams per serving serving_unit: Unit for serving size (e.g. "G", "ML", "OZ"). Default "G" number_of_units: Serving size in the specified unit. Default 100 serving_qty: Number of servings to log (default 1)
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"meal_date": "<meal_date>",
"meal_time": "<meal_time>",
"food_name": "<food_name>",
"calories": "<calories>"
},
"name": "upsert_and_log"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fat | No | ||
| carbs | No | ||
| protein | No | ||
| calories | Yes | ||
| food_name | Yes | ||
| meal_date | Yes | ||
| meal_time | Yes | ||
| serving_qty | No | ||
| serving_unit | No | G | |
| number_of_units | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |