Skip to main content
Glama

Metric and sample-size movement

real_or_sampling
Read-onlyIdempotent

Test whether a metric's latest departure persists after adjusting for its historical association with sample size, separating real change from sampling artifact when denominator data exist.

Instructions

Review whether the latest numeric metric departure persists after accounting for its historical linear association with measurement sample size. Use when both a dashboard metric and its coverage denominator are available; without a known denominator this check does not apply. Requires at least ten aligned pairs; shorter valid arrays return NOT_ENOUGH_HISTORY. The latest pair is excluded from the historical fit. Returns verdict, assessment, reading and, when estimable, metric_delta in input units, standardized departures, sample_size_change_pct as a percent of the historical median, fit and departure_after_conditioning. Prefer assessment/validity over legacy REAL or SAMPLING_ARTIFACT labels: linear association neither proves a sampling cause nor excludes confounding. Constant or weakly related histories can return UNCLEAR and null standardized values. Unequal array lengths or nonpositive sample sizes return a tool error.

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": {
      "values": "<values>",
      "sample_sizes": "<sample_sizes>"
    },
    "name": "real_or_sampling"
  }
}

Input Schema

NameRequiredDescriptionDefault
valuesYesChronological metric readings in consistent units, one per sample_sizes entry. At least 10 aligned pairs are needed; all earlier pairs form the reference for the latest reading.
sample_sizesYesPositive measurement denominators aligned one-for-one with values. Equal array length is required. Zero coverage is missing data, not a valid denominator; economic trading volume is not measurement coverage.

Output Schema

NameRequiredDescriptionDefault
fitNoHistorical linear association, when estimable.
errorNoValidation or computation failure message; inspect MCP isError or the HTTP status.
methodNoDescriptive denominator-conditioning method.
caveatsNoOrdered statements or identifiers.
n_pairsNoNumber of aligned metric/measurement-denominator pairs.
readingNoExplanation and limits of the result.
verdictNoLegacy descriptive result code.
validityNoDescriptive assessment, not a probability or statistical certificate.
guaranteeNoNo statistical or market-performance guarantee is made.
is_causalNoAssociation does not establish causality.
assessmentNoPreferred interpretation of the legacy verdict.
metric_nowNoLatest metric in input units.
metric_deltaNoLatest metric minus historical median, in input units.
sample_size_nowNoLatest declared measurement denominator.
metric_departureNoRobust standardized latest metric departure. Null means unavailable or not applicable, never zero.
sample_size_departureNoRobust standardized denominator departure. Null means unavailable or not applicable, never zero.
zero_reference_spreadNoHistorical metric MAD is zero.
sample_size_change_pctNoDenominator change as percent of its historical median.
denominator_extrapolationNoLatest denominator falls outside the historical range.
departure_after_conditioningNoRobust standardized latest residual after linear conditioning. Null means unavailable or not applicable, never zero.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv0.4.3
    • removedOutput schema / additionalProperties
      Removed value: -true
    • addedOutput schema / anyOf
      Added value: +[
      +  {
      +    "additionalProperties": false,
      +    "properties": {
      +      "assessment": {},
      +      "caveats": {},
      +      "denominator_extrapolation": {},
      +      "departure_after_conditioning": {},
      +      "fit": {},
      +      "guarantee": {},
      +      "is_causal": {},
      +      "method": {},
      +      "metric_delta": {},
      +      "metric_departure": {},
      +      "metric_now": {},
      +      "n_pairs": {},
      +      "reading": {},
      +      "sample_size_change_pct": {},
      +      "sample_size_departure": {},
      +      "sample_size_now": {},
      +      "validity": {},
      +      "verdict": {},
      +      "zero_reference_spread": {}
      +    },
      +    "required": [
      +      "n_pairs",
      +      "validity",
      +      "guarantee",
      +      "is_causal",
      +      "method",
      +      "caveats",
      +      "verdict",
      +      "assessment",
      +      "reading"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "additionalProperties": false,
      +    "description": "Existing tool-error payload; no successful result fields are implied.",
      +    "properties": {
      +      "error": {
      +        "description": "Validation or computation failure message; inspect MCP isError or the HTTP status.",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "error"
      +    ],
      +    "type": "object"
      +  }
      +]
    • changedOutput schema / description
      Previous value: -"Tool-specific result object described in each tool's description. Check status/ok/state, reading, validity and limits before using numbers. MCP returns this object in structuredContent and JSON text; invalid input returns isError=true with an error field. No tool fetches sources or executes trades."New value: +"Short histories omit departure/fit fields; later branches retain only quantities that were computed. Tool errors retain the separate error-message shape."
    • addedOutput schema / properties
      Added value: +{
      +  "assessment": {
      +    "description": "Preferred interpretation of the legacy verdict.",
      +    "enum": [
      +      "insufficient_history",
      +      "no_supported_departure",
      +      "departure_from_zero_spread",
      +      "denominator_explanation_unidentified",
      +      "weak_linear_association",
      +      "consistent_with_denominator_association",
      +      "departure_survives_linear_conditioning"
      +    ],
      +    "type": "string"
      +  },
      +  "caveats": {
      +    "description": "Ordered statements or identifiers.",
      +    "items": {
      +      "description": "One retained statement or identifier.",
      +      "type": "string"
      +    },
      +    "type": "array"
      +  },
      +  "denominator_extrapolation": {
      +    "description": "Latest denominator falls outside the historical range.",
      +    "type": "boolean"
      +  },
      +  "departure_after_conditioning": {
      +    "anyOf": [
      +      {
      +        "description": "Robust standardized latest residual after linear conditioning.",
      +        "type": "number"
      +      },
      +      {
      +        "type": "null"
      +      }
      +    ],
      +    "description": "Robust standardized latest residual after linear conditioning. Null means unavailable or not applicable, never zero."
      +  },
      +  "error": {
      +    "description": "Validation or computation failure message; inspect MCP isError or the HTTP status.",
      +    "type": "string"
      +  },
      +  "fit": {
      +    "additionalProperties": false,
      +    "description": "Historical linear association, when estimable.",
      +    "properties": {
      +      "correlation": {
      +        "description": "Historical linear correlation, rounded to three decimals.",
      +        "type": "number"
      +      },
      +      "intercept": {
      +        "description": "Metric units.",
      +        "type": "number"
      +      },
      +      "slope": {
      +        "description": "Metric units per denominator unit.",
      +        "type": "number"
      +      }
      +    },
      +    "required": [
      +      "slope",
      +      "intercept",
      +      "correlation"
      +    ],
      +    "type": "object"
      +  },
      +  "guarantee": {
      +    "description": "No statistical or market-performance guarantee is made.",
      +    "type": "null"
      +  },
      +  "is_causal": {
      +    "const": false,
      +    "description": "Association does not establish causality.",
      +    "type": "boolean"
      +  },
      +  "method": {
      +    "description": "Descriptive denominator-conditioning method.",
      +    "type": "string"
      +  },
      +  "metric_delta": {
      +    "description": "Latest metric minus historical median, in input units.",
      +    "type": "number"
      +  },
      +  "metric_departure": {
      +    "anyOf": [
      +      {
      +        "description": "Robust standardized latest metric departure.",
      +        "type": "number"
      +      },
      +      {
      +        "type": "null"
      +      }
      +    ],
      +    "description": "Robust standardized latest metric departure. Null means unavailable or not applicable, never zero."
      +  },
      +  "metric_now": {
      +    "description": "Latest metric in input units.",
      +    "type": "number"
      +  },
      +  "n_pairs": {
      +    "description": "Number of aligned metric/measurement-denominator pairs.",
      +    "minimum": 0,
      +    "type": "integer"
      +  },
      +  "reading": {
      +    "description": "Explanation and limits of the result.",
      +    "type": "string"
      +  },
      +  "sample_size_change_pct": {
      +    "description": "Denominator change as percent of its historical median.",
      +    "type": "number"
      +  },
      +  "sample_size_departure": {
      +    "anyOf": [
      +      {
      +        "description": "Robust standardized denominator departure.",
      +        "type": "number"
      +      },
      +      {
      +        "type": "null"
      +      }
      +    ],
      +    "description": "Robust standardized denominator departure. Null means unavailable or not applicable, never zero."
      +  },
      +  "sample_size_now": {
      +    "description": "Latest declared measurement denominator.",
      +    "type": "number"
      +  },
      +  "validity": {
      +    "const": "descriptive",
      +    "description": "Descriptive assessment, not a probability or statistical certificate.",
      +    "type": "string"
      +  },
      +  "verdict": {
      +    "description": "Legacy descriptive result code.",
      +    "enum": [
      +      "NOT_ENOUGH_HISTORY",
      +      "NO_MOVE",
      +      "UNCLEAR",
      +      "SAMPLING_ARTIFACT",
      +      "REAL"
      +    ],
      +    "type": "string"
      +  },
      +  "zero_reference_spread": {
      +    "description": "Historical metric MAD is zero.",
      +    "type": "boolean"
      +  }
      +}
  2. Changed3 schema fields changedv0.4.3-glama.1
    • addedInput schema / properties / sample_sizes / description
      Added value: +"Positive measurement denominators aligned one-for-one with values. Equal array length is required. Zero coverage is missing data, not a valid denominator; economic trading volume is not measurement coverage."
    • addedInput schema / properties / values / description
      Added value: +"Chronological metric readings in consistent units, one per sample_sizes entry. At least 10 aligned pairs are needed; all earlier pairs form the reference for the latest reading."
    • addedOutput schema / description
      Added value: +"Tool-specific result object described in each tool's description. Check status/ok/state, reading, validity and limits before using numbers. MCP returns this object in structuredContent and JSON text; invalid input returns isError=true with an error field. No tool fetches sources or executes trades."
  3. Changed8 schema fields changedv0.4.1
    • removedInput schema / properties / sample_sizes / description
      Removed value: -"the denominator behind each reading, same order and length"
    • addedInput schema / properties / sample_sizes / items / exclusiveMinimum
      Added value: +0
    • addedInput schema / properties / sample_sizes / maxItems
      Added value: +2048
    • addedInput schema / properties / sample_sizes / minItems
      Added value: +1
    • removedInput schema / properties / values / description
      Removed value: -"the metric's history, oldest first"
    • addedInput schema / properties / values / maxItems
      Added value: +2048
    • addedInput schema / properties / values / minItems
      Added value: +1
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "type": "object"
      +}
  4. First observedv0.1.2

TDQS

A4.3/5.0
Behavior5/5

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

Beyond the readOnly/idempotent/closed annotations, the description discloses the minimum history requirement and its NOT_ENOUGH_HISTORY return, that the latest pair is excluded from the fit, the degenerate cases that yield UNCLEAR with null standardized values, and the error conditions (unequal lengths, nonpositive sample sizes). That is substantial behavioral context the annotations do not carry.

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?

Purpose and applicability are front-loaded, and the later sentences cover preconditions, return shape, and interpretation in a logical progression with no filler. It is dense but slightly overpacked, with the return-field enumeration competing for attention against the more important applicability rule.

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, yet the description still explains how to read the verdict and warns against over-interpreting legacy REAL/SAMPLING_ARTIFACT labels in favor of assessment/validity. Combined with its edge-case and error coverage, an agent has everything needed to invoke and interpret the tool correctly.

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 a baseline of 3 would be defensible, but the description adds genuine meaning about how the arrays are consumed: the earlier aligned pairs form the reference distribution and the latest pair is held out. This clarifies the positional contract in a way the schema alone does not emphasize.

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

Purpose4/5

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

The description states a specific operation in concrete terms: test whether the latest metric departure persists after conditioning on its historical linear relationship with sample size. That is a clear verb+resource, and 'metric departure' plus 'coverage denominator' pins down the input domain. It does not explicitly contrast itself with plausible siblings such as did_it_change, so it falls short of full sibling differentiation.

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 an explicit applicability condition ('use when both a dashboard metric and its coverage denominator are available') and an explicit exclusion ('without a known denominator this check does not apply'), which is exactly the when/when-not split an agent needs. It stops short of naming an alternative tool to use when the condition fails, which keeps it off a 5.

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