Skip to content

Commit cdb08c7

Browse files
committed
new tool: snapshot
1 parent 0df22e4 commit cdb08c7

File tree

2 files changed

+28
-5
lines changed

2 files changed

+28
-5
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ use the same PATH your shell does. On macOS, it's typically
3838
- stress (weekly and daily)
3939
- daily intensity minutes
4040
- monthly activity summary
41+
- snapshot

src/garth_mcp_server/__init__.py

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from mcp.server.fastmcp import FastMCP
77

88

9-
__version__ = "0.0.5"
9+
__version__ = "0.0.6"
1010

1111
server = FastMCP("Garth - Garmin Connect", dependencies=["garth"], version=__version__)
1212

@@ -25,7 +25,17 @@ def wrapper(*args, **kwargs):
2525

2626
@server.tool()
2727
@requires_garth_session
28-
def get_nightly_sleep(
28+
def get_connectapi_endpoint(endpoint: str) -> str | dict | None:
29+
"""
30+
Get the data from a given Garmin Connect API endpoint.
31+
This is a generic tool that can be used to get data from any Garmin Connect API endpoint.
32+
"""
33+
return garth.connectapi(endpoint)
34+
35+
36+
@server.tool()
37+
@requires_garth_session
38+
def nightly_sleep(
2939
end_date: date | None = None, nights: int = 1
3040
) -> str | list[garth.SleepData]:
3141
"""
@@ -41,7 +51,7 @@ def get_nightly_sleep(
4151

4252
@server.tool()
4353
@requires_garth_session
44-
def get_daily_stress(
54+
def daily_stress(
4555
end_date: date | None = None, days: int = 1
4656
) -> str | list[garth.DailyStress]:
4757
"""
@@ -54,7 +64,7 @@ def get_daily_stress(
5464

5565
@server.tool()
5666
@requires_garth_session
57-
def get_weekly_stress(
67+
def weekly_stress(
5868
end_date: date | None = None, weeks: int = 1
5969
) -> str | list[garth.WeeklyStress]:
6070
"""
@@ -67,7 +77,7 @@ def get_weekly_stress(
6777

6878
@server.tool()
6979
@requires_garth_session
70-
def get_daily_intensity_minutes(
80+
def daily_intensity_minutes(
7181
end_date: date | None = None, days: int = 1
7282
) -> str | list[garth.DailyIntensityMinutes]:
7383
"""
@@ -87,6 +97,18 @@ def monthly_activity_summary(month: int, year: int) -> str | dict | None:
8797
return garth.connectapi(f"mobile-gateway/calendar/year/{year}/month/{month}")
8898

8999

100+
@server.tool()
101+
@requires_garth_session
102+
def snapshot(from_date: date, to_date: date) -> str | dict | None:
103+
"""
104+
Get the snapshot for a given date range. This is a good starting point for
105+
getting data for a given date range. It can be used in combination with
106+
the get_connectapi_endpoint tool to get data from any Garmin Connect API
107+
endpoint.
108+
"""
109+
return garth.connectapi(f"mobile-gateway/snapshot/detail/v2/{from_date}/{to_date}")
110+
111+
90112
def main():
91113
server.run()
92114

0 commit comments

Comments
 (0)