Skip to main content
Glama

Apple Health: run SQL

health_query
Read-only

Run one read-only SQLite query against Apple Health data to return JSON rows for daily metrics, sleep, and workouts, using aggregate functions or LIMIT to keep results focused.

Instructions

Run one read-only SQLite query on the user's Apple Health database and get rows as JSON (at most 2000; aggregate or LIMIT). Start from the daily view (one row per day: steps, energy, resting heart rate, HRV, sleep, weight and more), nights for sleep, workouts for training. health_overview lists every view and column.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "sql": "<sql>"
    },
    "name": "health_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYesOne SQLite SELECT statement.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true and openWorldHint=false, so the safety profile is covered. The description adds genuinely new behavior facts: the 2000-row ceiling and JSON row output. However, it does not say what happens when the cap is hit (truncation vs. error), nor anything about query timeouts or heavy-scan limits on a large local database.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with the verb and the read-only constraint, then the view inventory in priority order. No filler; every clause carries information an agent needs before writing a query.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter SQL tool with no output schema, this covers purpose, target views, schema lookup path, and the row cap. The remaining gap is edge-case behavior at the 2000-row boundary and whether expensive queries are rejected.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and there is a single parameter, so baseline is 3; the description earns above that by naming the concrete views and their contents, which is exactly the semantic aid needed to author the `sql` string. It stops short of documenting dialect restrictions or whether non-SELECT statements fail how.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Run one read-only SQLite query on the user's Apple Health database') plus the return shape ('rows as JSON'), and names the view landscape that distinguishes it from health_overview. An agent can tell immediately what this does and what it is not for.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives concrete starting points ('Start from the `daily` view... `nights` for sleep, `workouts` for training') and routes schema discovery to health_overview. The row-cap workaround ('aggregate or LIMIT') is also specified. No explicit when-not-to-use case, and the relationship to health_overview is implied rather than stated as an either/or.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools