feat(meal-planner): add add_meal_to_meal_plan tool (v0.11.2)

New write tool using mpcreate endpoint for free-text meal entries
(no recipe link). Parameters verified from JS-bundle. Returns raw
response pending production verification; structured output →  v0.11.3.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-17 12:10:20 +02:00
parent d344251796
commit 0ed9d62e4a
6 changed files with 72 additions and 7 deletions
+1 -1
View File
@@ -1 +1 @@
__version__ = "0.11.1"
__version__ = "0.11.2"
+47
View File
@@ -2387,6 +2387,53 @@ def add_recipe_to_meal_plan(
return json.dumps(result, ensure_ascii=False, indent=2)
# ---------------------------------------------------------------------------
# Tool: add_meal_to_meal_plan
# ---------------------------------------------------------------------------
@mcp.tool()
def add_meal_to_meal_plan(
name: str,
date: str,
meal_type: str,
) -> str:
"""Add a free-text meal entry to the meal plan.
IMPORTANT: Ask the user for confirmation before calling this tool.
Use this when the meal has no recipe in the recipe box.
For meals from the recipe box use ``add_recipe_to_meal_plan`` instead.
Args:
name: Display name of the meal (e.g. ``"Pfannkuchen"``).
date: Target date in ISO format (e.g. ``"2026-04-20"``).
meal_type: Meal slot — one of ``"BREAKFAST"``, ``"LUNCH"``,
``"SNACK"``, or ``"DINNER"``.
Returns:
JSON with the new dish entry on success, or an error message.
"""
if meal_type not in ("BREAKFAST", "LUNCH", "SNACK", "DINNER"):
return "Error: meal_type must be one of 'BREAKFAST', 'LUNCH', 'SNACK', 'DINNER'."
if not name or not name.strip():
return "Error: 'name' must not be empty."
params: dict[str, Any] = {
"name": name,
"date": date,
"type": meal_type,
}
try:
data = _authenticated_call("mpcreate", params)
except RuntimeError as exc:
return f"Error: {exc}"
# Return raw response until the structure is verified in production.
return json.dumps(data, ensure_ascii=False, indent=2)
# ---------------------------------------------------------------------------
# Factory
# ---------------------------------------------------------------------------