cronometer-mcp 2.0.2__tar.gz → 2.0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cronometer-mcp
3
- Version: 2.0.2
3
+ Version: 2.0.3
4
4
  Summary: MCP server for Cronometer nutrition data — pull food logs, macros, and micronutrients via the Model Context Protocol
5
5
  Project-URL: Homepage, https://github.com/cphoskins/cronometer-mcp
6
6
  Project-URL: Repository, https://github.com/cphoskins/cronometer-mcp
@@ -1,6 +1,6 @@
1
1
  """Cronometer MCP Server — nutrition data from Cronometer via MCP."""
2
2
 
3
- __version__ = "2.0.2"
3
+ __version__ = "2.0.3"
4
4
 
5
5
  from .client import CronometerClient
6
6
  from .markdown import generate_food_log_md
@@ -309,9 +309,9 @@ GWT_ADD_REPEAT_ITEM = (
309
309
  "java.util.ArrayList/4159755760|"
310
310
  "java.lang.Integer/3438268394|"
311
311
  "{food_name}|"
312
- "1|2|3|4|3|5|6|7|8|{user_id}|7|{diary_group}|"
312
+ "1|2|3|4|3|5|6|7|8|{user_id}|7|{quantity}|"
313
313
  "9|{day_count}|{day_entries}|"
314
- "0|11|{quantity}|0|{measure_id}|{food_source_id}|0|"
314
+ "0|11|{diary_group}|0|{food_source_id}|{food_id}|0|"
315
315
  )
316
316
 
317
317
  GWT_DELETE_REPEAT_ITEM = (
@@ -2375,7 +2375,7 @@ class CronometerClient:
2375
2375
  def add_repeat_item(
2376
2376
  self,
2377
2377
  food_source_id: int,
2378
- measure_id: int,
2378
+ food_id: int,
2379
2379
  quantity: float,
2380
2380
  food_name: str,
2381
2381
  diary_group: int = 1,
@@ -2385,9 +2385,8 @@ class CronometerClient:
2385
2385
 
2386
2386
  Args:
2387
2387
  food_source_id: Food source ID from search_foods.
2388
- measure_id: Measure/unit ID. Use UNIVERSAL_MEASURE_ID with
2389
- quantity=weight_grams for reliable results.
2390
- quantity: Serving quantity (or weight_grams if using universal measure).
2388
+ food_id: Food ID from search_foods.
2389
+ quantity: Number of default servings (e.g., 12 cups of coffee).
2391
2390
  food_name: Display name for the food.
2392
2391
  diary_group: Meal slot — 1=Breakfast, 2=Lunch, 3=Dinner, 4=Snacks.
2393
2392
  days_of_week: List of days (0=Sun, 1=Mon, ..., 6=Sat).
@@ -2404,7 +2403,7 @@ class CronometerClient:
2404
2403
  # Build day entries: "10|{day}" for each day, joined by "|"
2405
2404
  day_entries = "|".join(f"10|{d}" for d in days_of_week)
2406
2405
 
2407
- # Format quantity
2406
+ # Format quantity as float-like string for GWT
2408
2407
  qty_str = str(int(quantity)) if quantity == int(quantity) else str(quantity)
2409
2408
 
2410
2409
  body = (
@@ -2417,8 +2416,8 @@ class CronometerClient:
2417
2416
  .replace("{day_count}", str(len(days_of_week)))
2418
2417
  .replace("{day_entries}", day_entries)
2419
2418
  .replace("{quantity}", qty_str)
2420
- .replace("{measure_id}", str(measure_id))
2421
2419
  .replace("{food_source_id}", str(food_source_id))
2420
+ .replace("{food_id}", str(food_id))
2422
2421
  )
2423
2422
  raw = self._gwt_post(body)
2424
2423
  if not raw.startswith("//OK"):
@@ -1049,8 +1049,8 @@ def get_repeated_items() -> str:
1049
1049
 
1050
1050
  @mcp.tool()
1051
1051
  def add_repeat_item(
1052
+ food_id: int,
1052
1053
  food_source_id: int,
1053
- measure_id: int,
1054
1054
  quantity: float,
1055
1055
  food_name: str,
1056
1056
  diary_group: str = "Breakfast",
@@ -1058,10 +1058,15 @@ def add_repeat_item(
1058
1058
  ) -> str:
1059
1059
  """Add a recurring food entry that auto-logs on selected days.
1060
1060
 
1061
+ Quantity is in default servings for the food (e.g., for coffee where
1062
+ the default serving is 1 cup, quantity=12 means 12 cups).
1063
+
1064
+ Use search_foods to find food_id and food_source_id.
1065
+
1061
1066
  Args:
1062
- food_source_id: Food source ID from search_foods.
1063
- measure_id: Measure/unit ID. Use 0 for universal gram-based measure.
1064
- quantity: Serving quantity (or weight_grams if using universal measure).
1067
+ food_id: Numeric food ID from search_foods results.
1068
+ food_source_id: Food source ID from search_foods results.
1069
+ quantity: Number of default servings.
1065
1070
  food_name: Display name for the food.
1066
1071
  diary_group: Meal slot — "Breakfast", "Lunch", "Dinner", or "Snacks".
1067
1072
  days_of_week: Comma-separated day numbers (0=Sun, 1=Mon, ..., 6=Sat),
@@ -1079,10 +1084,6 @@ def add_repeat_item(
1079
1084
  ),
1080
1085
  })
1081
1086
 
1082
- if measure_id == 0:
1083
- from .client import UNIVERSAL_MEASURE_ID
1084
- measure_id = UNIVERSAL_MEASURE_ID
1085
-
1086
1087
  # Parse days_of_week
1087
1088
  days_str = days_of_week.strip().lower()
1088
1089
  if days_str == "all":
@@ -1097,7 +1098,7 @@ def add_repeat_item(
1097
1098
  client = _get_client()
1098
1099
  client.add_repeat_item(
1099
1100
  food_source_id=food_source_id,
1100
- measure_id=measure_id,
1101
+ food_id=food_id,
1101
1102
  quantity=quantity,
1102
1103
  food_name=food_name,
1103
1104
  diary_group=group_int,
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "cronometer-mcp"
7
- version = "2.0.2"
7
+ version = "2.0.3"
8
8
  description = "MCP server for Cronometer nutrition data — pull food logs, macros, and micronutrients via the Model Context Protocol"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -6,12 +6,12 @@
6
6
  "url": "https://github.com/cphoskins/cronometer-mcp",
7
7
  "source": "github"
8
8
  },
9
- "version": "2.0.2",
9
+ "version": "2.0.3",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "pypi",
13
13
  "identifier": "cronometer-mcp",
14
- "version": "2.0.2",
14
+ "version": "2.0.3",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  },
@@ -1515,7 +1515,7 @@ class TestAddRepeatItem:
1515
1515
  )
1516
1516
  result = c.add_repeat_item(
1517
1517
  food_source_id=1055762,
1518
- measure_id=461776,
1518
+ food_id=1055762,
1519
1519
  quantity=1.0,
1520
1520
  food_name="Wasa Crispbread",
1521
1521
  )
@@ -1531,7 +1531,7 @@ class TestAddRepeatItem:
1531
1531
  )
1532
1532
  c.add_repeat_item(
1533
1533
  food_source_id=1055762,
1534
- measure_id=461776,
1534
+ food_id=1055762,
1535
1535
  quantity=1.0,
1536
1536
  food_name="Wasa Crispbread",
1537
1537
  )
@@ -1549,7 +1549,7 @@ class TestAddRepeatItem:
1549
1549
  )
1550
1550
  c.add_repeat_item(
1551
1551
  food_source_id=1055762,
1552
- measure_id=461776,
1552
+ food_id=1055762,
1553
1553
  quantity=1.0,
1554
1554
  food_name="Test",
1555
1555
  )
@@ -1567,7 +1567,7 @@ class TestAddRepeatItem:
1567
1567
  )
1568
1568
  c.add_repeat_item(
1569
1569
  food_source_id=1055762,
1570
- measure_id=461776,
1570
+ food_id=1055762,
1571
1571
  quantity=1.0,
1572
1572
  food_name="Test",
1573
1573
  days_of_week=[1, 3, 5], # Mon, Wed, Fri
@@ -1587,7 +1587,7 @@ class TestAddRepeatItem:
1587
1587
  with pytest.raises(RuntimeError, match="GWT-RPC call failed"):
1588
1588
  c.add_repeat_item(
1589
1589
  food_source_id=1055762,
1590
- measure_id=461776,
1590
+ food_id=1055762,
1591
1591
  quantity=1.0,
1592
1592
  food_name="Test",
1593
1593
  )
File without changes
File without changes