Skip to main content
Glama

Correlate two metrics

correlate_metrics
Read-only

Compare two metrics over a date range, calculating Pearson's r and Spearman's rho across day lags to find lead-lag relationships.

Instructions

Correlate two metrics over a range, sweeping a range of day-offsets.

Joins the two metrics by UTC calendar date rather than by cycle, and reports Pearson's r and Spearman's rho at every lag from -lag_days to +lag_days (inclusive), each with its own sample size. A positive lag means metric_a's date precedes metric_b's by that many days -- metric_a "leads". A lag whose surviving pairs fall below 8 is reported as refused rather than omitted.

Correlation here is descriptive, not causal: WHOOP daily samples are autocorrelated (today's recovery is not independent of yesterday's), so do not read a strong r at some lag as proof that one metric drives the other, and do not treat a handful of weeks as a stable finding.

Args: metric_a: First metric name, as in metric_trend. metric_b: Second metric name. start: ISO 8601 start of the range. end: ISO 8601 end of the range. lag_days: Sweep radius in days (default 3, capped at 14); the sweep covers every integer lag from -lag_days to +lag_days.

Raises: ValueError: if lag_days is negative.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endYes
startYes
lag_daysNo
metric_aYes
metric_bYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

The annotations already declare readOnlyHint=true and destructiveHint=false, so the safety profile is known. The description adds substantial behavioral context: joining by UTC calendar date rather than by cycle, the meaning of positive lag (metric_a leads), the refusal threshold of 8 pairs, and autocorrelation warning. This goes well beyond annotations and provides essential 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 longer than average, but every sentence adds value—statistical caveats, lag semantics, and edge cases are all substantive. It is well-structured with a summary paragraph followed by an Args section. While slightly verbose, the length is justified by the tool's complexity.

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 the tool's statistical complexity and 0% schema coverage, the description covers all essential aspects: lag range, join method, correlation coefficients, sample size threshold, error condition (ValueError for negative lag_days), and causal limitations. An output schema exists, so return values don't need explanation, but the description is complete for usage.

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

Parameters5/5

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

Schema description coverage is 0%, so the description must carry the full burden, and it does. It explains metric_a as 'as in metric_trend', clarifies start/end as ISO 8601, and adds critical details for lag_days: default 3, capped at 14, and the inclusive sweep from -lag_days to +lag_days. All 5 parameters are meaningfully described, far exceeding the bare schema.

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 states a specific action: 'Correlate two metrics over a range, sweeping a range of day-offsets.' It clearly distinguishes from siblings like metric_trend (single metric trend) and compare_periods (period comparison) by focusing on lagged correlation between two metrics. The inclusion of Pearson's r and Spearman's rho at every lag further specifies the scope.

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 strong contextual guidance, explaining when results are meaningful and cautioning against causal interpretation: 'Correlation here is descriptive, not causal' and 'do not read a strong r at some lag as proof that one metric drives the other.' While it does not explicitly name alternative tools for different use cases, it gives clear context on the appropriate interpretation and limitations, which is nearly as useful.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kurok/whoopmcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server