get_events
Retrieve planned workouts and races from your training calendar by specifying date ranges. Use this tool to access scheduled athletic events for training planning and performance analysis.
Instructions
Get planned workouts and races from the calendar.
Args: oldest: Start date in YYYY-MM-DD format (inclusive). newest: End date in YYYY-MM-DD format (inclusive).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| oldest | No | ||
| newest | No |
Implementation Reference
- main.py:103-119 (handler)The get_events tool handler function that fetches planned workouts and races from the calendar. Takes optional oldest/newest date parameters and returns a list of events from the Intervals.icu API.
@mcp.tool() def get_events( oldest: str | None = None, newest: str | None = None, ) -> list: """Get planned workouts and races from the calendar. Args: oldest: Start date in YYYY-MM-DD format (inclusive). newest: End date in YYYY-MM-DD format (inclusive). """ params: dict[str, Any] = {} if oldest: params["oldest"] = oldest if newest: params["newest"] = newest return _get(f"/athlete/{ATHLETE_ID}/events", params) - main.py:18-22 (helper)Helper function _get that makes HTTP GET requests to the Intervals.icu API. Used by get_events and other tools to fetch data.
def _get(path: str, params: dict[str, Any] | None = None) -> Any: with _client() as client: r = client.get(path, params=params) r.raise_for_status() return r.json() - main.py:14-15 (helper)Helper function _client that creates and configures an httpx Client with API authentication for Intervals.icu API requests.
def _client() -> httpx.Client: return httpx.Client(auth=("API_KEY", API_KEY), base_url=BASE_URL)