name: fh-usage description: Reference guide for Function Health MCP data model, auth flow, and tool patterns user-invocable: false
Function Health MCP — Usage Reference
Background context for working with Function Health lab data. This skill is loaded automatically to help you use the FH tools effectively.
Data Model: Test Rounds
Function Health runs comprehensive lab panels requiring 1-3 lab visits over several weeks. All visits within one test round share the same requisitionId.
- Results are grouped by round, not individual visit dates
- Each round directory is keyed by the earliest visit date (e.g.,
2026-01-20/) round-meta.jsonin each directory contains: requisitionId, visitDates, resultCount- A complete round typically has 100+ biomarkers across multiple categories
Offline-First Architecture
Query tools read from ~/.function-health/exports/ — they never hit the API:
fh_results,fh_biomarker,fh_summary,fh_categories,fh_changes,fh_recommendations,fh_report
Only two tools make API calls:
fh_sync— full data pull, writes to local storefh_check— lightweight requisition count check
Authentication Flow
Login is CLI-only (password requires hidden terminal input):
npx -y -p function-health-mcp function-health login
The fh_login MCP tool only checks auth status and directs users to the CLI command. Never attempt to collect credentials through the MCP tool.
Credentials are stored at ~/.function-health/credentials.json (0o600 permissions). Tokens auto-refresh via Firebase JWT. If the refresh token is revoked, the server falls back to re-login using FH_EMAIL and FH_PASSWORD (from environment variables or ~/lifeos/.env / ~/.env files). Check authHint in fh_status output for guidance when auth fails.
Tool Parameter Patterns
- Fuzzy biomarker matching: Names are matched case-insensitively with substring matching. "vitamin d" matches "Vitamin D, 25-Hydroxy".
- Filter options:
fh_resultsacceptsstatus("in_range" | "out_of_range"),category,biomarker, andvisitfilters. - Optional date params:
fh_changesacceptsfromandtodate strings; defaults to comparing the two most recent rounds. - Force sync:
fh_synchas a 1-hour cooldown. Passforce: trueto override.
Change Notifications
When fh_sync detects changes between rounds, it writes notification files to ~/.function-health/changes/:
- Files are JSON with timestamps, accumulate until acknowledged
fh_notificationsreads pending notifications (call withoutacknowledge)fh_notificationswithacknowledge: trueclears them- Notifications persist across conversations — missed days don't lose data
- Capped at 100 files (oldest pruned automatically)
Common Patterns
- Always start with
fh_status— confirms auth, data availability, and last sync time - Sync before querying if no data —
fh_statusshowshasData: falsewhen exports are empty - Results come from
/results-report— thebiomarkerResultsRecordfield, NOT the/resultsendpoint (which returns PDFs) - Compare complete rounds —
fh_changescompares all markers across entire rounds, not individual visits - Daily briefing pattern — check
fh_notificationsfirst, present changes, then acknowledge