feat(recipes): add get_recipe_box + parser-fix ingredients_parsed (v0.11.7)
- New tool get_recipe_box: filtered version of get_recipes returning only real recipes (isRecipe=true), excluding stubs created for free-text meal entries - Parser fix: ingredients_parsed now generated from free-text ingredients field instead of API's ingredientsList which has parser bug on comma+space (e.g. '1, 5g' breaks) - Updated SPEC.md with parser bug documentation - Updated version to 0.11.7 in __init__.py and pyproject.toml - Updated .gitignore to exclude debug/test scripts Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1956,6 +1956,32 @@ def get_recipes() -> str:
|
||||
return json.dumps(result, ensure_ascii=False, indent=2)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Tool: get_recipe_box
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
def get_recipe_box() -> str:
|
||||
"""Return only real recipes from the recipe box (isRecipe=true).
|
||||
|
||||
Excludes stub recipes that are auto-created when free-text meal plan
|
||||
entries are added. Use this for meal planning and ingredient lookups.
|
||||
For the full list including stubs use get_recipes.
|
||||
|
||||
Returns:
|
||||
JSON list of recipe summary objects (same format as get_recipes).
|
||||
Returns an error message string on failure.
|
||||
"""
|
||||
try:
|
||||
raw_recipes = _get_raw_recipes()
|
||||
except RuntimeError as exc:
|
||||
return f"Error: {exc}"
|
||||
|
||||
result = [parse_recipe_summary(r) for r in raw_recipes if r.get("isRecipe") == "true"]
|
||||
return json.dumps(result, ensure_ascii=False, indent=2)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Tool: get_recipe
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user