Skip to main content
Glama

Internal rate of return

calc_irr
Read-onlyIdempotent

Periodic and annualized IRR of periodic cash flows, as decimals (0.085 = 8.5%), solved deterministically by scanning a 1-point grid of per-period rates and bisecting each sign change; reports every root it finds when cash flows have multiple IRRs (two roots within one grid step can be missed). Errors when the flows do not change sign or no root lies between -99.99% and 1000% per period. Deterministic: the same inputs always give the same result, with formula ID calc.irr@2, every step, and any warnings.

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": {
      "cash_flows": "<cash_flows>"
    },
    "name": "calc_irr"
  }
}

Input Schema

NameRequiredDescriptionDefault
cash_flowsYesPeriodic cash flows at t = 0, 1, 2, …; negative for outflows (e.g. purchase price at t = 0). At most 1200.
periods_per_yearNoCash-flow periods per year, used only to annualize the result: 1 for annual flows, 4 for quarterly, 12 for monthly.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • removedInput schema / properties / periods_per_year / exclusiveMinimum
      Removed value: -0
    • removedInput schema / properties / periods_per_year / maximum
      Removed value: -9007199254740991
    • addedInput schema / properties / periods_per_year / minimum
      Added value: +1
  2. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Goes well beyond the readOnly/idempotent annotations: it discloses the output units, the deterministic grid-scan-plus-bisection method, the known correctness limitation (two roots within one grid step can be missed), the complete root-reporting behavior, exact error conditions, and a formula ID for traceability. That is precisely the kind of algorithmic and failure-mode context an agent needs before trusting the number.

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 purpose and units, then limitations, then determinism — a sensible order with almost no filler. The closing sentence repeats determinism already asserted in the opening clause, so a small amount of redundancy remains.

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?

With no output schema, the description carries the return-value burden itself and does so: units, the shape of the result (every root found), and error behavior are all covered. For a two-parameter read-only calculation, nothing an agent needs in order to call it or interpret its output 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 real meaning by pinning the output to decimals and clarifying that both a periodic and an annualized figure are produced (the role of periods_per_year). It does not restate the cash-flow sign convention, which the schema already handles.

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 and resource: computes periodic and annualized IRR of periodic cash flows. It also fixes the output convention (decimals, 0.085 = 8.5%), which distinguishes it unambiguously from the NPV sizing sibling and from the other calc_* tools.

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?

Gives clear conditions under which the tool fails (no sign change, no root between -99.99% and 1000% per period) and warns of the multi-root case, which tells the agent when results may be ambiguous. It does not name an alternative tool for discounted-value work or state prerequisites, so it stops short of explicit when-to-use-vs-alternative routing.

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.