delete_meal
Remove a logged meal from your fitness tracker, with an option to delete associated food items to maintain accurate nutrition records.
Instructions
Delete a meal and optionally its items.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| meal_id | Yes | ||
| delete_items | No |
Implementation Reference
- src/main.py:600-609 (handler)The 'delete_meal' tool handler implementation. It optionally deletes associated meal items before deleting the meal itself.
def delete_meal(meal_id: int, delete_items: bool = True) -> dict[str, bool]: """Delete a meal and optionally its items.""" conn = get_connection() cursor = conn.cursor() if delete_items: cursor.execute("DELETE FROM meal_items WHERE meal_id = ?", (meal_id,)) cursor.execute("DELETE FROM meals WHERE id = ?", (meal_id,)) conn.commit() conn.close() return {"deleted": cursor.rowcount > 0}