Skip to main content
Glama

Compute metrics

compute-metrics
DestructiveIdempotent

Resolves the Derive rules scoped to a metric block (block_type='metric'), binds each rule's operands to the entity's most recent persisted report facts at period_end, evaluates, and upserts the period's standing factset_type='metric' FactSet — one per (structure, entity, period_end), so successive runs accumulate the time series and re-running a period replaces its values. Metrics with missing operands or undefined ratios are skipped with a reason, never errored.

Example tool call

This call uses example arguments supplied in the tool’s input schema.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "period_end": "2026-03-31",
      "structure_id": "str_key_financial_metrics"
    },
    "name": "compute-metrics"
  }
}

Input Schema

NameRequiredDescriptionDefault
entity_idNoThe entity whose metrics to compute, by id. Omit for the group parent.
period_endYesPeriod end to compute at. Operands bind to report facts whose period_end matches exactly (instant balances as of this date; durations ending on it).
scenario_idNoCompute on a scenario slice: operands bind that scenario's facts (actuals as the fallback across the seam) and the standing metric set is stamped with the scenario. None (the default) computes actuals only. Pass a forecast block's structure id after compute-forecast to extend the metric series into its forward months.
period_startNoOptional lower bound for duration-operand binding and the standing FactSet's period_start.
structure_idYesMetric block structure (block_type='metric') to compute.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.1/5.0
Behavior5/5

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

The description adds substantial behavior beyond the annotations: it explains upsert semantics, that re-running a period replaces its values, that successive runs accumulate a time series, and that missing operands or undefined ratios are skipped with a reason rather than erroring. These details are consistent with destructiveHint=true and idempotentHint=true.

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 dense but efficient, and every clause contributes to purpose, behavior, or error handling. Its single long sentence is less scannable than a structured breakdown, but it is not padded.

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?

For a complex mutating computation tool with no output schema, the description covers the important operational behavior: binding, evaluation, upsert/replacement, time-series accumulation, and skip behavior. It could say more about permissions or return details, but the annotations and description together provide sufficient context to invoke it correctly.

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?

Schema description coverage is 100%, so the schema already carries the parameter-level meaning. The description reinforces period_end binding and metric-block scoping but does not add significant semantics beyond the fully documented input 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 sequence of actions on a specific resource: resolving Derive rules for a metric block, binding operands, evaluating, and upserting a factset_type='metric' FactSet. It clearly distinguishes the operation from generic fact creation by naming the metric-block scope and the standing metric time series.

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

Usage Guidelines3/5

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

Usage context is implied by the operation itself and the scenario parameter explains actuals versus scenario slicing, including using a forecast structure after compute-forecast. However, there is no explicit when-to-use or when-not-to-use guidance relative to nearby sibling tools such as assert-metrics.

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.