Skip to main content
Glama
Thecimal

Quantified Self MCP Server

Find correlation between two metrics

find_metric_correlation
Read-onlyIdempotent

Compute the Pearson correlation between two personal metrics over a date range, with optional lag to test predictive relationships. Use it to see whether metrics move together and quantify the strength of their association.

Instructions

Compute the Pearson correlation between two metrics over the same window, joined by date. Correlation, not causation: a strong r just means the two moved together, not that one caused the other.

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
end_dateNoLast day to include, formatted YYYY-MM-DD. Defaults to today.
lag_daysNoShift metric_b this many days later before joining — 1 tests whether metric_a today predicts metric_b tomorrow (e.g. "does poor sleep tonight predict lower steps tomorrow?"). 0 (default) compares same-day values.
metric_aYes
metric_bYes
start_dateNoFirst day to include, formatted YYYY-MM-DD. Defaults to 90 days before end_date.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
nYes
rNo
noteNo
lag_daysYes
metric_aYes
metric_bYes
evidence_aNo
evidence_bNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedOutput schema / properties / evidence_a
      Added value: +{
      +  "anyOf": [
      +    {
      +      "description": "Coverage/quality of the data a single-metric analytical result is\nbased on. See evidence.build_evidence for how each field is computed.",
      +      "properties": {
      +        "confidence": {
      +          "type": "string"
      +        },
      +        "coverage_ratio": {
      +          "type": "number"
      +        },
      +        "expected_days": {
      +          "type": "integer"
      +        },
      +        "freshness_days": {
      +          "anyOf": [
      +            {
      +              "type": "integer"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ],
      +          "default": null
      +        },
      +        "gaps": {
      +          "items": {
      +            "properties": {
      +              "days": {
      +                "type": "integer"
      +              },
      +              "end": {
      +                "type": "string"
      +              },
      +              "start": {
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "start",
      +              "end",
      +              "days"
      +            ],
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        "measurement_count": {
      +          "type": "integer"
      +        },
      +        "missing_days": {
      +          "type": "integer"
      +        },
      +        "observed_days": {
      +          "type": "integer"
      +        },
      +        "observed_end": {
      +          "anyOf": [
      +            {
      +              "type": "string"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ],
      +          "default": null
      +        },
      +        "observed_start": {
      +          "anyOf": [
      +            {
      +              "type": "string"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ],
      +          "default": null
      +        },
      +        "recent_gap_days": {
      +          "type": "integer"
      +        },
      +        "requested_end": {
      +          "type": "string"
      +        },
      +        "requested_start": {
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "requested_start",
      +        "requested_end",
      +        "expected_days",
      +        "observed_days",
      +        "coverage_ratio",
      +        "missing_days",
      +        "measurement_count",
      +        "gaps",
      +        "recent_gap_days",
      +        "confidence"
      +      ],
      +      "type": "object"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null
      +}
    • addedOutput schema / properties / evidence_b
      Added value: +{
      +  "anyOf": [
      +    {
      +      "description": "Coverage/quality of the data a single-metric analytical result is\nbased on. See evidence.build_evidence for how each field is computed.",
      +      "properties": {
      +        "confidence": {
      +          "type": "string"
      +        },
      +        "coverage_ratio": {
      +          "type": "number"
      +        },
      +        "expected_days": {
      +          "type": "integer"
      +        },
      +        "freshness_days": {
      +          "anyOf": [
      +            {
      +              "type": "integer"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ],
      +          "default": null
      +        },
      +        "gaps": {
      +          "items": {
      +            "properties": {
      +              "days": {
      +                "type": "integer"
      +              },
      +              "end": {
      +                "type": "string"
      +              },
      +              "start": {
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "start",
      +              "end",
      +              "days"
      +            ],
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        "measurement_count": {
      +          "type": "integer"
      +        },
      +        "missing_days": {
      +          "type": "integer"
      +        },
      +        "observed_days": {
      +          "type": "integer"
      +        },
      +        "observed_end": {
      +          "anyOf": [
      +            {
      +              "type": "string"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ],
      +          "default": null
      +        },
      +        "observed_start": {
      +          "anyOf": [
      +            {
      +              "type": "string"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ],
      +          "default": null
      +        },
      +        "recent_gap_days": {
      +          "type": "integer"
      +        },
      +        "requested_end": {
      +          "type": "string"
      +        },
      +        "requested_start": {
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "requested_start",
      +        "requested_end",
      +        "expected_days",
      +        "observed_days",
      +        "coverage_ratio",
      +        "missing_days",
      +        "measurement_count",
      +        "gaps",
      +        "recent_gap_days",
      +        "confidence"
      +      ],
      +      "type": "object"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null
      +}
  2. Addedv1.0.16
  3. Removedv1.0.15
  4. Addedv1.0.11

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, and openWorldHint=false. The description adds useful behavioral context: the caveat that correlation does not imply causation, the fact that metrics are joined by date, and a privacy warning about data becoming part of the conversation sent to the model. These go beyond the annotations without contradicting them.

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 main purpose is front-loaded in the first sentence, followed by a brief interpretation caveat and a privacy note. Both additions are relevant and concise, though the privacy note is somewhat longer than typical tool descriptions.

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?

With an output schema present and annotations covering read-only/idempotent behavior, the description does not need to explain return formats. It covers interpretation, data handling, and the join behavior. It could be more complete by explicitly naming sibling alternatives, but for a unique correlation tool this is a minor gap.

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

Parameters3/5

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

The schema already documents start_date, end_date, and lag_days with formats, defaults, and a worked example. The description adds the general idea of joining two metrics by date, but does not add meaning to metric_a or metric_b beyond their self-evident roles. Schema coverage is 60%, and the missing parameter descriptions are not critical.

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 uses a specific verb ('Compute') and resource ('Pearson correlation between two metrics'), and specifies the behavior: 'over the same window, joined by date'. This clearly distinguishes it from sibling tools that analyze single metrics, compare periods, or detect anomalies.

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?

The description provides clear context: use this tool when the goal is to compute the Pearson correlation between two metrics over a shared time window. It does not explicitly name alternatives or state when not to use it, but the purpose is specific enough that an agent can route correctly.

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