diff --git a/CLAUDE.md b/CLAUDE.md index 4c42bfd..e631a71 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -24,7 +24,7 @@ und wird in Claude Desktop eingebunden. ## Aktueller Stand -### Implementierte Tools (v0.11.0) +### Implementierte Tools (v0.11.1) | Kategorie | Tools | |---|---| @@ -63,7 +63,8 @@ und wird in Claude Desktop eingebunden. - v0.10.1: get_meal_plan strukturierter Output + SPEC.md mplistinterval Response verifiziert ✓ - v0.10.2: get_meal_plan mealList[] einbinden (Freitext-Notizen + Portionen), merged + sortiert ✓ - v0.10.3: get_meal_plan is_from_recipe_box Feld (recipeList[].isRecipe Lookup) ✓ -- v0.11.0: add_recipe_to_meal_plan (mpcreateByRecipeId; raw response bis Struktur verifiziert) ✓ ← aktuell +- v0.11.0: add_recipe_to_meal_plan (mpcreateByRecipeId; raw response bis Struktur verifiziert) ✓ +- v0.11.1: add_recipe_to_meal_plan strukturierter Output (Response verifiziert) ✓ ← aktuell - v2.0: Schreibzugriff auf Wall-Posts (Erstellen, Kommentieren) diff --git a/README.md b/README.md index c2466c5..f678d78 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ MCP server for [Family Wall](https://www.familywall.com) -- read and manage your family's circles, lists, tasks, and recipes directly from Claude. -## Features (v0.11.0) +## Features (v0.11.1) ### Read diff --git a/SPEC.md b/SPEC.md index 117cbaf..c207415 100644 --- a/SPEC.md +++ b/SPEC.md @@ -734,9 +734,23 @@ POST https://api.familywall.com/api/mpcreateByRecipeId | `type` | ja | Mahlzeiten-Typ: `BREAKFAST`, `LUNCH`, `SNACK`, `DINNER` | | `clientOpId` | nein | Optionale Client-seitige Idempotenz-ID (wird weggelassen) | -**Response-Struktur:** TBD — Tool liefert Raw JSON zur Verifizierung (→ v0.11.1). +**Response-Struktur:** +``` +a00.r.r → vollständiges dish-Objekt + .metaId → neue Dish-ID (z.B. "dish/16282169_20009811") + .date → Datum (z.B. "2026-04-18") + .type → Mahlzeiten-Typ (BREAKFAST/LUNCH/SNACK/DINNER) + .name → Rezeptname + .recipeId → verknüpfte Rezept-metaId + .familyId → Kreis-metaId + .accountId → Ersteller-accountId + .sortingIndex → Sortierung (numerischer Timestamp als String) + .rights.canUpdate → "true" + .rights.canDelete → "true" +a00.cn → "mpcreateByRecipeId" (Endpoint-Echo) +``` -**Verifiziert am:** 2026-04-17 (Parameter aus JS-Bundle; Response TBD) +**Verifiziert am:** 2026-04-17 via FW_DEBUG=1 ### Weitere Meal Planner Endpoints (nicht implementiert) diff --git a/pyproject.toml b/pyproject.toml index ecc2458..031c071 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "mcp-familywall" -version = "0.11.0" +version = "0.11.1" description = "MCP server for Family Wall — read your family's lists and tasks via Claude" readme = "README.md" requires-python = ">=3.12" diff --git a/src/mcp_familywall/__init__.py b/src/mcp_familywall/__init__.py index ae6db5f..fee46bd 100644 --- a/src/mcp_familywall/__init__.py +++ b/src/mcp_familywall/__init__.py @@ -1 +1 @@ -__version__ = "0.11.0" +__version__ = "0.11.1" diff --git a/src/mcp_familywall/server.py b/src/mcp_familywall/server.py index 1b04739..a6390d1 100644 --- a/src/mcp_familywall/server.py +++ b/src/mcp_familywall/server.py @@ -2359,8 +2359,32 @@ def add_recipe_to_meal_plan( 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) + try: + dish = data["a00"]["r"]["r"] + if not isinstance(dish, dict) or "metaId" not in dish: + raise TypeError("unexpected shape") + except (KeyError, TypeError): + return json.dumps( + {"warning": "Unexpected mpcreateByRecipeId response structure", "raw": data}, + ensure_ascii=False, + indent=2, + ) + + rights = dish.get("rights") or {} + result: dict[str, Any] = { + "id": dish.get("metaId"), + "date": dish.get("date"), + "type": dish.get("type"), + "name": dish.get("name"), + "recipe_id": dish.get("recipeId") or None, + # mpcreateByRecipeId always creates entries from the recipe box. + "is_from_recipe_box": True, + "note": None, + "serves": None, + "can_update": rights.get("canUpdate") == "true", + "can_delete": rights.get("canDelete") == "true", + } + return json.dumps(result, ensure_ascii=False, indent=2) # ---------------------------------------------------------------------------