Skip to main content
Glama

deep_analysis

Read-onlyIdempotent

Deep Analysis: read-only SQLite SQL over a private copy of the user's full health history. Use for: questions spanning several data types (training with sleep, nutrition with weight); long or all-time horizons; trends, progress, period comparisons; totals, averages, rankings, correlations; anything focused tools would need many calls for; any request for a "deep analysis". For one recent fact (today's workout, last night's sleep), goals or profile use the focused tool. mode=discover: for tables or columns not listed below. topics -> matching tables with columns, units, row counts, dates; no topics -> table index. mode=query: one SELECT/WITH. period or date_from/date_to limits the copy (faster); omit for all history. Core tables, date = local day, main columns only (discover lists the rest): sleep_log: date, bedtime, wake_time, total_hours, sleep_score, deep_sleep_hours, rem_sleep_hours, light_sleep_hours, awakenings body_metrics: date, weight_lb, body_fat_pct, lean_mass_lb, fat_mass_lb, bmi, muscle_mass_lb, waist_in workout_sessions: id, date, started_at, activity_label, focus_type, duration_sec, calories, distance_mi, rpe daily_nutrition: date, total_calories, total_protein, total_fat, total_carbs (g), total_alcohol_kcal, meal_count wearable_daily: date, step_count, resting_hr_display, hrv_morning, active_calories_burned, total_calories_burned, stress_score, vo2max_estimate, spo2_avg_pct Every result carries calendar; the first also carries user_rules. Take relative dates from calendar or period, never your own math. Results list coverage per table (dates, rows, cuts): a short or empty result is not proof data is missing. Scope dates to the request. Joining sessions to sets repeats session values: aggregate each level alone, then join. Not every session is lifting: filter by activity for strength questions. An association is not a cause. Values stored in lb, mi, kcal, C: convert to user_rules units. Plain table names (wearable_daily, sleep_log, body_metrics, runs, food_log, hydration_entries) hold what the app counts; *_by_source hold raw per-source rows: never total those. Dates are YYYY-MM-DD. Timestamps are UTC: group and filter by local_date. glucose_readings_daily and hydration_entries_daily are per local day and source, for long ranges; if a copy is refused for size, query the _daily table or narrow the dates. Helpers: median(x), percentile(x,p), stddev(x) (NULL under 3 values), corr(x,y) (NULL under 8 pairs), corr_n(x,y) (pairs used), week_start(date[,dow 0=Sun 1=Mon]), month_start(date). Report n with any statistic.

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": {
      "mode": "<mode>"
    },
    "name": "deep_analysis"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlNoquery: one SELECT or WITH statement.
modeYesSee mode= lines above.
periodNoquery: a named calendar period, resolved by the server; sets the dates copied.
topicsNodiscover: subjects or table names, e.g. ["sleep","resting heart rate"].
date_toNoquery: last date to copy, YYYY-MM-DD.
purposeNoquery: what this answers, a few words.
date_fromNoquery: first date to copy, YYYY-MM-DD.

Output Schema

NameRequiredDescriptionDefault
resultYesHuman-readable result text returned by the tool.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.8/5.0
Behavior5/5

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

Beyond the read-only, idempotent, non-destructive annotations, it discloses important behavior: the query runs against a private copy, date filters limit that copy, result coverage is reported per table, and short results are not proof of missing data. It also warns about raw *_by_source tables, timestamp local-date handling, unit conversion, helper functions, and statistical caveats.

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

Conciseness4/5

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

The description is long and dense, but it is front-loaded with purpose and use-case routing before moving into schema, SQL, date, and helper details. Most sentences carry operational value for a complex SQL tool, though the long unbroken block could be easier to scan with clearer segmentation.

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

Completeness5/5

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

Given a complex, high-parameter analytical tool with an output schema and rich annotations, the description is exceptionally complete. It covers when to use it, how modes differ, table and date semantics, result coverage, unit conversion, raw-source-table pitfalls, and statistical helper behavior.

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%, so the schema already documents all seven parameters, but the description adds substantial meaning about mode=discover returning tables/columns/units/row counts/dates and mode=query accepting one SELECT/WITH while period or date_from/date_to scopes the copied data. It does not elaborate on the purpose parameter, but otherwise it meaningfully extends the schema's parameter guidance.

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?

The description opens with a precise verb-and-resource statement: read-only SQLite SQL over a private copy of the user's full health history. It then distinguishes this broad analytical tool from focused tools for single recent facts, goals, or profile queries, so an agent can identify its role immediately.

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

Usage Guidelines5/5

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

It gives explicit "Use for" conditions spanning multiple data types, long horizons, trends, comparisons, totals, rankings, and correlations. It also gives a clear exclusion: for one recent fact, goals, or profile, use the focused tool, and it explains when to choose mode=discover versus mode=query.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.