Skip to content

MCP Tools

The Protocol server exposes a set of MCP tools that an AI assistant calls on the user's behalf. Every tool is either a read (annotated READ - safe, idempotent) or a write (annotated WRITE - mutates data). All calls are authenticated via OAuth and scoped to the signed-in user through RLS.

Schemas are derived from Pydantic models in server/features/ and enforced at the MCP protocol boundary - the LLM sees typed parameters, not free-form text.

Source: server/features/user.py

ToolKindDescription
get_user_profilereadBasic demographics - name, sex, date of birth
get_user_health_profilereadConditions, family history, substances, diet, activity, methodology, priorities
update_user_health_profilewritePartial update of any health-profile field (omitted fields preserved)
get_user_preferencesreadLocale, units, currency, date format, communication style
update_user_preferenceswritePartial update of any preference (omitted fields preserved)
get_user_contextreadProfile + health profile + preferences in a single joined call - prefer this for session warm-up

Source: server/features/supplements.py. Inventory is shared across the household - one catalog, not per user. IDs resolved here are passed into journal / context tools below.

ToolKindDescription
get_inventory_listreadList every item in the shared catalog. Call first to resolve inventory_id
get_inventoryreadFull details for a single inventory item by ID
add_inventorywriteAdd a new supplement to the catalog. Check the list first to avoid (name, brand) conflicts
update_inventorywritePartial update of catalog fields

The SCD Type 2 history of what the user is taking. Every regimen change closes one row and opens another, linked via replaces_id - see Schema.

ToolKindDescription
get_supplement_protocolreadAll currently active supplements - the full active protocol with dosages, schedules, and purpose
get_supplementreadCurrent entry for a given inventory_id (or the most recent if none active)
get_supplement_historyreadFull chronological history for a supplement - every entry, oldest first
add_supplementwriteStart taking a supplement. Requires replaces_id + replacement_reason if the user has prior history for this item
update_supplement_replacewriteChange dosage / frequency / time blocks. Closes the current entry (optional ended_at, defaults to today) and opens a new one (optional started_at, defaults to today) via SCD Type 2
update_supplement_endwriteStop taking a supplement without a replacement - sets ended_at to today

Why the user takes a given supplement. Separate from the journal because purpose changes rarely while dosage / timing change often.

ToolKindDescription
add_contextwriteAttach a purpose list (['bone health', 'immune support']) to a user+supplement pair. One context entry per pair
update_contextwriteReplace the purpose list for an existing context entry

Tools tagged READ are annotated as safe and idempotent - MCP clients may call them speculatively, cache results, or use them for context pre-loading. Tools tagged WRITE will not be called without user confirmation in well-behaved clients. The annotations are applied via the READ / WRITE constants in server/utils/mcp_annotations.py.