list_activities
Retrieve a list of Garmin workouts with optional filters for activity type, search term, and pagination.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_activities"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| start | No | ||
| activityType | No | ||
| search | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The `list_activities` MCP tool handler function. It accepts optional parameters (limit, start, activityType, search), builds query params, and calls the Garmin Connect API via _connectapi helper at the LIST_ACTIVITIES_ENDPOINT path.
@mcp.tool def list_activities(limit: int = 20, start: int = 0, activityType: str | None = None, search: str | None = None) -> dict: params = {"limit": limit, "start": start} if activityType is not None: params["activityType"] = activityType if search is not None: params["search"] = search return {"activities": _connectapi(LIST_ACTIVITIES_ENDPOINT, params=params)} - src/garmin_workouts_mcp/server.py:163-163 (registration)The `@mcp.tool` decorator on line 163 registers list_activities as an MCP tool with the FastMCP server instance.
@mcp.tool - The `_connectapi` helper function that wraps garth.connectapi(), ensuring authentication is performed before each API call. It is used by list_activities to make the actual HTTP request.
def _connectapi(endpoint: str, method: str = "GET", **kwargs) -> dict: _ensure_authenticated() return garth.connectapi(endpoint, method=method, **kwargs) - The constant LIST_ACTIVITIES_ENDPOINT defining the Garmin API path used by list_activities to fetch activity data.
LIST_ACTIVITIES_ENDPOINT = "/activitylist-service/activities/search/activities"