get_today_sleep_data
Retrieve today's sleep metrics from your Oura Ring to analyze sleep quality, duration, and patterns for health monitoring.
Instructions
Get sleep data for today.
Returns:
Dictionary containing sleep data for today
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/oura_mcp_server/server.py:407-422 (handler)The handler and registration for the 'get_today_sleep_data' tool. This function is decorated with @mcp.tool() to register it with the MCP server and implements the core logic: checks if Oura client is initialized, gets today's date, and fetches sleep data via the client.@mcp.tool() def get_today_sleep_data() -> dict[str, Any]: """ Get sleep data for today. Returns: Dictionary containing sleep 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_sleep_data(today, today) except Exception as e: return {"error": str(e)}