get_today_readiness_data
Retrieve today’s readiness data from the Oura API to assess personal health metrics. The tool integrates with the Oura MCP Server, enabling natural language queries and practical health insights.
Instructions
Get readiness data for today.
Returns:
Dictionary containing readiness data for today
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"title": "get_today_readiness_dataArguments",
"type": "object"
}
Implementation Reference
- src/oura_mcp_server/server.py:425-440 (handler)MCP tool handler for 'get_today_readiness_data', decorated with @mcp.tool(). Retrieves today's readiness data using the OuraClient instance.@mcp.tool() def get_today_readiness_data() -> dict[str, Any]: """ Get readiness data for today. Returns: Dictionary containing readiness data for today """ if oura_client is None: return {"error": "Oura client not initialized. Please provide an access token."} try: today = date.today() return oura_client.get_readiness_data(today, today) except Exception as e: return {"error": str(e)}
- OuraClient.get_readiness_data method: Fetches readiness data from Oura API for a date range, removes id/timestamp fields, and returns transformed data. Called by the tool handler.def get_readiness_data( self, start_date: date, end_date: Optional[date] = None ) -> dict[str, Any]: """ Get readiness data for a specific date range. Args: start_date: Start date for the query end_date: End date for the query (optional, defaults to start_date) Returns: Dictionary containing readiness data """ if end_date is None: end_date = start_date params = { "start_date": start_date.isoformat(), "end_date": end_date.isoformat(), } url = f"{self.BASE_URL}/daily_readiness" response = self.client.get(url, headers=self.headers, params=params) if response.status_code != 200: error_msg = f"Error {response.status_code}: {response.text}" raise Exception(error_msg) # Get the raw response raw_data = response.json() # Transform the data - just return the data array directly transformed_data = [] for item in raw_data.get("data", []): # Create transformed item without the id field and timestamp fields transformed_item = { k: v for k, v in item.items() if k != "id" and not k.endswith("_timestamp") and k != "timestamp" } transformed_data.append(transformed_item) # Return with the original structure but with transformed data return {"data": transformed_data}