Skip to main content

Overview

Mirobody Health includes two essential health tools that enable AI agents to access and analyze user health data securely.

get_user_health_profile

Retrieve comprehensive user profile and summary

get_health_indicator

Query specific health metrics and time-series data

get_user_health_profile

Retrieves the user’s complete health profile including connected devices, summary statistics, and profile information.

Function Signature

async def get_user_health_profile(user_info: UserInfo) -> Dict[str, Any]:
    """
    Get user health profile including connected devices and summary data
    
    Args:
        user_info: User authentication information (automatically injected)
        
    Returns:
        Dict containing:
            - profile: User profile information
            - connected_providers: List of linked health devices
            - summary: Health data summary and statistics
    """

Parameters

user_info
UserInfo
required
User authentication information. This parameter is automatically provided by the system when called through MCP. Do not manually pass this parameter.

Use Cases

  • Profile Overview: Display user’s health profile in a dashboard
  • Device Status: Check which devices are connected and syncing
  • Data Availability: Verify what health data is available for analysis
  • Agent Context: Provide agents with user context for personalized responses

get_health_indicator

Retrieves specific health indicator data with optional time range filtering.

Function Signature

async def get_health_indicator(
    user_info: UserInfo,
    indicator: str,
    start_time: Optional[str] = None,
    end_time: Optional[str] = None,
    limit: Optional[int] = 100
) -> List[Dict[str, Any]]:
    """
    Get health indicator data for a specific metric
    
    Args:
        user_info: User authentication information (automatically injected)
        indicator: Health indicator name (e.g., "HEART_RATE", "STEPS", "SLEEP_DURATION")
        start_time: Optional start time filter (ISO 8601 format)
        end_time: Optional end time filter (ISO 8601 format)
        limit: Maximum number of records to return (default: 100)
        
    Returns:
        List of health indicator records with values and timestamps
    """

Parameters

user_info
UserInfo
required
User authentication information (automatically provided)
indicator
string
required
Health indicator name. Examples:
  • HEART_RATE: Heart rate measurements
  • DAILY_STEPS: Daily step count
  • SLEEP_DURATION: Sleep duration
  • HRV: Heart rate variability
  • WEIGHT: Body weight
See Standard Indicators for complete list.
start_time
string
Start time for filtering data (ISO 8601 format). Example: 2024-01-01T00:00:00Z
end_time
string
End time for filtering data (ISO 8601 format). Example: 2024-01-15T23:59:59Z
limit
integer
Maximum number of records to return. Default: 100, Maximum: 1000

Use Cases

  • Trend Analysis: Query heart rate data over a week to analyze trends
  • Comparative Analysis: Compare sleep duration across different months
  • Correlation Studies: Examine relationships between different health metrics
  • Report Generation: Pull data for personalized health reports

Querying Health Data

Both tools query the theta_ai.th_series_data table which contains standardized health indicators from all connected devices.

Available Indicators

  • DAILY_STEPS: Step count per day
  • DAILY_DISTANCE: Distance traveled
  • DAILY_CALORIES_ACTIVE: Active calories burned
  • DAILY_CALORIES_BASAL: Basal metabolic rate
  • ACTIVE_TIME: Active time duration
  • DAILY_FLOORS_CLIMBED: Floors climbed
  • HEART_RATE: Instantaneous heart rate
  • DAILY_HEART_RATE_RESTING: Resting heart rate
  • DAILY_HEART_RATE_MIN: Minimum daily heart rate
  • DAILY_HEART_RATE_MAX: Maximum daily heart rate
  • DAILY_AVG_HEART_RATE: Average daily heart rate
  • HRV: Heart rate variability (RMSSD)
  • DAILY_SLEEP_DURATION: Total sleep time
  • SLEEP_IN_BED: Time in bed
  • DAILY_AWAKE_TIME: Time awake during sleep
  • DAILY_LIGHT_SLEEP: Light sleep duration
  • DAILY_DEEP_SLEEP: Deep sleep duration
  • DAILY_REM_SLEEP: REM sleep duration
  • SLEEP_EFFICIENCY: Sleep efficiency percentage
  • WEIGHT: Body weight
  • HEIGHT: Height
  • BMI: Body mass index
  • BODY_FAT_PERCENTAGE: Body fat percentage
  • SKELETAL_MUSCLE_MASS: Skeletal muscle mass

Example Agent Queries

Here are examples of how AI agents can use these tools:
User: “What health devices do I have connected?”Agent Action:
profile = await get_user_health_profile(user_info)
connected = profile["connected_providers"]
Response: “You have 2 devices connected: Garmin (last synced 2 hours ago) and Whoop (last synced 1 hour ago).”

Security

All user data tools require OAuth authentication. The user_info parameter is automatically validated before tool execution.
Tools can only access data for the authenticated user. Cross-user data access is prevented at the database level.
All tool calls are logged with user ID, timestamp, and parameters for security auditing.

Next Steps