Skip to main content
Glama

MetricDuck — Financial Analysis

Metric Lineage

get_metric_lineage
Read-only

The DERIVATION of one COMPUTED metric — its human formula + immediate inputs (each value + source), one level at a time. The audit / verify affordance for derived figures (margins, ratios, ROIC, FCF, adj-EBITDA): call it ONLY when the query asks how a metric is computed, which definition MetricDuck used, or to verify / audit the derivation — NOT to get the value itself (use get_metric_history / get_company_overview for that).

Drillable (lazy, one level per call):

  • a derived input points to its OWN derivation — call get_metric_lineage(ticker, that_symbol) to go deeper.

  • a base input is an as-filed XBRL fact — open its filing handle, or get_xbrl_facts(ticker, search="") to land on the exact fact.

Use Cases:

  • "How is AAPL's net_margin calculated?" -> get_metric_lineage("AAPL", "net_margin")

  • "Which ROIC definition does this use?" -> get_metric_lineage("AAPL", "roic")

  • "Audit / verify gross_margin for Q2 FY2025" -> get_metric_lineage("AAPL", "gross_margin", fiscal_year=2025, fiscal_period="Q2")

Computed metrics only — a base as-filed figure has no derivation (the tool says so and points to get_xbrl_facts).

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": {
      "ticker": "<ticker>",
      "metric": "<metric>"
    },
    "name": "get_metric_lineage"
  }
}

Input Schema

NameRequiredDescriptionDefault
metricYesMetric id of a COMPUTED metric (e.g. 'net_margin', 'roic', 'fcf', 'ev_ebitda').
tickerYesCompany ticker symbol (e.g., 'AAPL'). Must be exact.
fiscal_yearNoPin the fiscal year (e.g. 2025). Omit for the latest period.
period_typeNoQ = quarterly, FY = fiscal year, TTM = trailing 12 months.Q
fiscal_periodNoPin the fiscal period. Omit for the latest.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • removedInput schema / properties / segment
      Removed value: -{
      -  "description": "Reporting segment id. Omit for the consolidated figure.",
      -  "type": "string"
      -}
  2. First observed

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare readOnlyHint/openWorldHint/destructiveHint=false, so safety is covered; the description adds real behavioral context beyond that — the lazy one-level-at-a-time traversal, the derived vs base input distinction, and the fact that base as-filed figures return no derivation and redirect to get_xbrl_facts. It does not describe the response shape in detail, which keeps it below a 5 given there is no output schema.

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?

Front-loaded with the core definition before routing rules, use cases, and the computed-only caveat; bullets make the drill-down logic scannable. There is mild redundancy between the 'call it ONLY when' line and the Use Cases list, and the heavy emphasis formatting is slightly noisy.

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?

For a 5-parameter read tool with no output schema, the description covers purpose, when to use, when not to, recursion semantics, and the computed-only edge case with a fallback tool. Nothing an agent needs in order to invoke it correctly is 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 coverage is 100%, so the baseline is 3, but the description adds non-obvious meaning: the `metric` parameter must be a COMPUTED metric id, and that same parameter position accepts a derived input's symbol when drilling deeper. The worked examples also show how fiscal_year/fiscal_period pin a period.

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?

States a specific verb+resource: returns the derivation (formula plus immediate inputs with values and sources) of one computed metric, one level at a time. It explicitly distinguishes itself from get_metric_history and get_company_overview, which return values rather than derivations.

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

Usage Guidelines5/5

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

Gives explicit call conditions (how is a metric computed, which definition was used, verify/audit a derivation) and explicit exclusions ('NOT to get the value itself — use get_metric_history / get_company_overview'). Adds drill-down routing: derived inputs get a recursive call, base inputs route to a filing handle or get_xbrl_facts.

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.

Resources