Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/cronometer_api_mcp/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ def create_custom_food(
fiber_g: float = 0,
sugar_g: float = 0,
sodium_mg: float = 0,
saturated_fat_g: float = 0,
serving_name: str = "1 serving",
serving_grams: float = 100.0,
) -> dict:
Expand All @@ -331,6 +332,10 @@ def create_custom_food(
{"id": NUTRIENT_IDS["fiber"], "amount": round(fiber_g * scale, 2)},
{"id": NUTRIENT_IDS["sugar"], "amount": round(sugar_g * scale, 2)},
{"id": NUTRIENT_IDS["sodium"], "amount": round(sodium_mg * scale, 2)},
{
"id": NUTRIENT_IDS["saturated_fat"],
"amount": round(saturated_fat_g * scale, 2),
},
# Derived / calculated fields the app includes
{"id": -203, "amount": round(protein_g * scale, 2)},
{"id": -204, "amount": round(fat_g * scale, 2)},
Expand Down
3 changes: 3 additions & 0 deletions src/cronometer_api_mcp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ def add_custom_food(
fiber_g: float = 0,
sugar_g: float = 0,
sodium_mg: float = 0,
saturated_fat_g: float = 0,
serving_name: str = "1 serving",
serving_grams: float = 100.0,
) -> str:
Expand All @@ -534,6 +535,7 @@ def add_custom_food(
fiber_g: Fiber per serving (g, default 0).
sugar_g: Sugar per serving (g, default 0).
sodium_mg: Sodium per serving (mg, default 0).
saturated_fat_g: Saturated fat per serving (g, default 0).
serving_name: Name for the serving size (default "1 serving").
serving_grams: Weight of one serving in grams (default 100).
"""
Expand All @@ -548,6 +550,7 @@ def add_custom_food(
fiber_g=fiber_g,
sugar_g=sugar_g,
sodium_mg=sodium_mg,
saturated_fat_g=saturated_fat_g,
serving_name=serving_name,
serving_grams=serving_grams,
)
Expand Down
Loading