Skip to content

Commit 65c3e7e

Browse files
committed
remove startDate param
1 parent 0d12c5c commit 65c3e7e

File tree

1 file changed

+38
-18
lines changed

1 file changed

+38
-18
lines changed

src/garth_mcp_server/__init__.py

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from mcp.server.fastmcp import FastMCP
88

99

10-
__version__ = "0.0.9"
10+
__version__ = "0.0.10.dev0"
1111

1212
# Type alias for functions that return data from garth.connectapi
1313
ConnectAPIResponse = str | dict | list | int | float | bool | None
@@ -155,24 +155,44 @@ def daily_sleep(
155155

156156
@server.tool()
157157
@requires_garth_session
158-
def get_activities(
159-
start_date: str | None = None, limit: int | None = None
160-
) -> ConnectAPIResponse:
161-
"""
162-
Get list of activities from Garmin Connect.
163-
start_date: Start date for activities (YYYY-MM-DD format)
164-
limit: Maximum number of activities to return
165-
"""
166-
params = {}
167-
if start_date:
168-
params["startDate"] = start_date
169-
if limit:
170-
params["limit"] = str(limit)
171-
158+
def get_activities(start: int = 0, limit: int = 20) -> ConnectAPIResponse:
159+
"""
160+
Lists activities from Garmin Connect.
161+
162+
Parameters
163+
----------
164+
start : int, optional
165+
The zero-based index in the activity list from which to start returning results (default: 0).
166+
limit : int, optional
167+
The maximum number of activities to retrieve starting from 'start' (default: 20).
168+
169+
Returns
170+
-------
171+
activities : list
172+
List of activity records.
173+
174+
Notes
175+
-----
176+
Use 'start' and 'limit' to paginate through your activities, e.g. set start=0, limit=20 for the first page,
177+
start=20, limit=20 for the next page, etc.
178+
"""
179+
params = {
180+
"start": start,
181+
"limit": limit,
182+
}
172183
endpoint = "activitylist-service/activities/search/activities"
173-
if params:
174-
endpoint += "?" + urlencode(params)
175-
return garth.connectapi(endpoint)
184+
endpoint += "?" + urlencode(params)
185+
activities = garth.connectapi(endpoint)
186+
187+
# remove user roles and profile image urls
188+
for activity in activities:
189+
activity.pop("userRoles")
190+
activity.pop("ownerDisplayName")
191+
activity.pop("ownerProfileImageUrlSmall")
192+
activity.pop("ownerProfileImageUrlMedium")
193+
activity.pop("ownerProfileImageUrlLarge")
194+
195+
return activities
176196

177197

178198
@server.tool()

0 commit comments

Comments
 (0)