Read patched recipes by stable id
Co-authored-by: Bumble <bumble@agents.famfallman.com> Co-authored-by: fredamn76 <fredrik.fallman@gmail.com> Signed-off-by: fredamn76 <fredrik.fallman@gmail.com>
This commit is contained in:
@@ -329,10 +329,14 @@ def patch_recipe(slug_or_id: str, patch: dict[str, Any]) -> dict[str, Any]:
|
||||
"""Apply an explicit Mealie recipe patch, then read the recipe back.
|
||||
|
||||
Use this for tags and categories too — the bulk-action endpoints return 500 on
|
||||
this instance. Patch ``recipeCategory`` and ``tags`` directly.
|
||||
this instance. Patch ``recipeCategory`` and ``tags`` directly. The stable
|
||||
recipe id is captured before the PATCH because changing ``name`` also changes
|
||||
Mealie's slug, making the old slug invalid for read-back.
|
||||
"""
|
||||
before = get_recipe(slug_or_id)
|
||||
stable_id = before.get("id") or slug_or_id
|
||||
_request("PATCH", f"/api/recipes/{slug_or_id}", json=patch)
|
||||
return get_recipe(slug_or_id)
|
||||
return get_recipe(stable_id)
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
|
||||
Reference in New Issue
Block a user