What are Tools?
Tools are Python functions that enable AI agents to interact with health data, perform actions, and access external services. Mirobody Health’s tool system makes it incredibly easy to add custom functionality without complex configuration.Tools are automatically discovered from the
tools/ directory in your project root and exposed via the MCP protocol.Tool Architecture
Simple to Add
Write Python functions - no JSON schemas required
Auto-Discovery
Tools are automatically detected and registered
MCP Native
Instantly available via Model Context Protocol
Built-in Tools
Mirobody Health includes two essential health tools out of the box:1. get_user_health_profile
Retrieves comprehensive user health profile information.- User profile information
- Connected health devices/providers
- Health data summary and statistics
2. get_health_indicator
Retrieves specific health indicators for analysis.- Query heart rate data over time
- Retrieve sleep patterns
- Analyze activity trends
- Compare biomarkers
Tool Categories
- User Data Tools
- Public Data Tools
Private data tools that require authentication:
- Access user’s health indicators
- Query personal profiles
- Retrieve device data
- Analyze personal trends
- Must include
user_info: UserInfoparameter - OAuth authentication enforced automatically
- Data scoped to authenticated user only
How Tools Work
1
Tool Discovery
On startup, Mirobody Health scans the
tools/ directory for Python files containing Service classes.2
Auto-Registration
Each public method in a Service class is automatically registered as a tool.
3
MCP Exposure
Tools are exposed via the MCP protocol at
http://localhost:18080/mcp for AI agents to discover and call.4
Agent Invocation
AI agents (Claude, Cursor, ChatGPT) can discover and call your tools through the MCP interface.
Tool Configuration
Tools are configured inconfig.yaml:
config.yaml
Database Schema for Health Data
Tools can query standardized health data from these tables:theta_ai.th_series_data
Primary table for time-series health indicators:| Column | Type | Description |
|---|---|---|
id | integer | Primary key |
user_id | varchar | User identifier |
indicator | varchar | Indicator code/name |
value | text | Original indicator value |
value_standardized | text | Standardized indicator value |
start_time | timestamp | Indicator start time |
end_time | timestamp | Indicator end time |
source | varchar | Data source (system/device/manual) |
source_table | varchar | Original source table |
source_table_id | varchar | Source record ID |
indicator_id | text | Unique indicator identifier |
deleted | integer | Deletion flag (0: active, 1: deleted) |
create_time | timestamptz | Creation timestamp |
update_time | timestamptz | Last update timestamp |
task_id | varchar | Task ID |
full_dim_id | bigint | Full dimension ID |
fhir_id | bigint | FHIR resource ID |
fhir_mapping_info | jsonb | FHIR mapping information |
is_standardized | boolean | Standardization flag |
comment | text | Additional notes |
theta_ai.health_user_profile_by_system
User profile storage:| Column | Type | Description |
|---|---|---|
id | integer | Primary key |
user_id | varchar | User identifier |
version | integer | Version number |
name | varchar | Profile name |
last_execute_doc_id | integer | Last executed document ID |
common_part | varchar | Profile content (JSON) |
create_time | timestamp | Creation timestamp |
last_update_time | timestamp | Last update timestamp |
is_deleted | boolean | Deletion flag |