get_wellness
Retrieve wellness metrics like HRV, resting heart rate, sleep quality, and fatigue scores from intervals.icu data to analyze athletic recovery and training readiness.
Instructions
Get wellness data including HRV, resting HR, sleep, and fatigue scores.
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:84-100 (handler)Main handler function for get_wellness tool. Makes API request to /athlete/{ATHLETE_ID}/wellness with optional date filters (oldest, newest) and returns wellness data including HRV, resting HR, sleep, and fatigue scores.
@mcp.tool() def get_wellness( oldest: str | None = None, newest: str | None = None, ) -> list: """Get wellness data including HRV, resting HR, sleep, and fatigue scores. 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}/wellness", params) - main.py:85-88 (schema)Type hints define the input/output schema: two optional string parameters (oldest, newest) and a list return type.
def get_wellness( oldest: str | None = None, newest: str | None = None, ) -> list: - main.py:84-84 (registration)FastMCP @mcp.tool() decorator registers the get_wellness function as an MCP tool.
@mcp.tool() - main.py:18-22 (helper)Helper function _get makes HTTP GET requests to the Intervals.icu API. Used by get_wellness to fetch wellness 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()