Skip to main content
Glama
Quantified Self MCP Server

Quantified Self MCP Server

Preview a source-priority resolution of a day's measurements

aggregate_measurements
Read-onlyIdempotent

Preview how one day's raw measurements would aggregate under a chosen source priority and compare that preview with the actual stored daily values, without writing data.

Instructions

Preview what one day's raw measurements would roll up to if a conflicting metric were resolved using source_priority, alongside that day's actual current daily_metrics values.

daily_metrics is a database-maintained projection (see db/schema.sql): every log_measurement/import automatically keeps it in sync the moment it's written, using each metric's fixed aggregation method: summed for steps, sleep_hours, workout_minutes and water_ml; averaged for resting_heart_rate, mood, heart_rate and hrv_ms; the latest reading for weight_kg (see aggregation_rules). When a metric has more than one source on a day, the projection uses only one source's observations, never a blend: the highest-ranked present source in the stored priority list (manual log_daily_metric entries rank first by default), else the source with the most hours that day, then the latest observation, then by name. This tool writes nothing: "aggregated" previews what the source_priority you pass would produce; "row" is the real, currently-stored value. If a metric has more than one source that day, use get_metric_provenance first to see whether they actually disagree.

Privacy note: this server and its SQLite file are entirely local, but the data returned by this tool becomes part of the conversation sent to whatever model the calling client is configured with. If that model runs in the cloud rather than on your machine, treat this the same as pasting the data into a chat with that provider.

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": {
      "date": "<date>"
    },
    "name": "aggregate_measurements"
  }
}

Input Schema

NameRequiredDescriptionDefault
dateYesThe day to preview, formatted YYYY-MM-DD.
source_priorityNoOrdered list of source names, e.g. ["Apple Watch", "Garmin"]. For any metric with more than one source that day, the first name in this list that's actually present wins in "aggregated" and the other source's readings for that metric are dropped from that preview. Omit to use the stored priority list and the same fallback the stored projection uses. Never affects "row" — see above.

Output Schema

NameRequiredDescriptionDefault
rowYes
dateYes
aggregatedYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.0.23
    • changedInput schema / properties / source_priority / description
      Previous value: -"Ordered list of source names, e.g. [\"Apple\nWatch\", \"Garmin\"]. For any metric with more than one source\nthat day, the first name in this list that's actually present\nwins in \"aggregated\" and the other source's readings for that\nmetric are dropped from that preview. Omit to fall back to\nwhichever source was imported most recently. Never affects\n\"row\" — see above."New value: +"Ordered list of source names, e.g. [\"Apple\nWatch\", \"Garmin\"]. For any metric with more than one source\nthat day, the first name in this list that's actually present\nwins in \"aggregated\" and the other source's readings for that\nmetric are dropped from that preview. Omit to use the stored\npriority list and the same fallback the stored projection\nuses. Never affects \"row\" — see above."
  2. Changed2 schema fields changedv1.0.19
    • changedInput schema / properties / date / description
      Previous value: -"The day to aggregate, formatted YYYY-MM-DD."New value: +"The day to preview, formatted YYYY-MM-DD."
    • changedInput schema / properties / source_priority / description
      Previous value: -"Ordered list of source names, e.g. [\"Apple\nWatch\", \"Garmin\"]. For any metric with more than one source\nthat day, the first name in this list that's actually present\nwins and the other source's readings for that metric are\ndropped from the aggregate. Omit to fall back to whichever\nsource was imported most recently."New value: +"Ordered list of source names, e.g. [\"Apple\nWatch\", \"Garmin\"]. For any metric with more than one source\nthat day, the first name in this list that's actually present\nwins in \"aggregated\" and the other source's readings for that\nmetric are dropped from that preview. Omit to fall back to\nwhichever source was imported most recently. Never affects\n\"row\" — see above."
  3. Addedv1.0.16
  4. Removedv1.0.15
  5. Addedv1.0.11

TDQS

A4.5/5.0
Behavior5/5

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

Annotations already cover safety (readOnlyHint, destructiveHint=false, idempotentHint), but the description goes well beyond them: it explains exactly how the projection resolves conflicts (priority list, then most hours, then latest observation, then name), that aggregation is per-metric fixed rules, that nothing is written, and that "row" is never affected by source_priority. It also adds a privacy disclosure about data leaving the local SQLite file into a cloud-model conversation, which is not expressible in any annotation.

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

Conciseness3/5

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

The purpose is front-loaded, but the body is long for a two-parameter preview tool and spends several sentences enumerating per-metric aggregation methods (summed/averaged/latest) that are background documentation rather than invocation-critical. Some of this is justified by genuinely non-obvious behavior, but a tighter version could convey the same routing signal in far fewer tokens.

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?

An output schema exists, so return values need no explanation, and the description still covers the non-obvious pieces an agent needs: what the two result sections mean, that the tool is non-mutating, how conflicts resolve, and the local-data privacy implication. Nothing material for correct invocation appears to be missing.

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 description coverage is 100%, so the baseline is 3, but the description adds real meaning: source_priority is an ordered list where the first name actually present wins and competing sources' readings are dropped from the preview only, and omitting it falls back to the stored list and the same fallback the stored projection uses. That is a semantic detail beyond the schema's field-level text.

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 names a specific verb and resource: it previews what one day's raw measurements would roll up to under a given source_priority, next to the day's actual stored daily_metrics values. It also cleanly distinguishes the two outputs ("aggregated" preview vs "row" real value) so an agent can tell it apart from siblings like get_metric_history or get_metric_provenance.

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?

It gives a concrete routing rule: if a metric has more than one source that day, use get_metric_provenance first to see whether the sources actually disagree. It also makes clear this tool writes nothing, so it is safe as a dry-run check before writing. It does not explicitly name when-not-to-use this (e.g. versus get_metric_history for multi-day trends), so it stops short of full alternative coverage.

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