Skip to main content
Glama

TradingCalc MCP: Options, Forex, Risk Stats, Prediction Markets, On-Chain & Crypto Futures

Irr

workflow.run_irr
Read-only

Internal rate of return: the rate per period at which the NPV of a list of cash flows is zero (first flow at time 0). The flows need at least one outflow and one inflow. One sign change in the flows (all outflows first, then all inflows) gives exactly one answer, returned as irr with unique true. With several sign changes there can be several rates or none: every rate found is listed in irrs and irr is null even when only one rate was found (reason "unverified"), with reason "multiple_roots" or "none_found" otherwise, so do not quote one rate as the return. With one sign change the search reaches about 1e13 per period; beyond that reason is "none_found". The search covers rates from -99% to +9,900% per period on a 0.2% grid of ln(1 + rate); two roots closer than that, or a root where NPV only touches zero, can be missed. Give periodsPerYear to also get the annual effective rate. Edge cases: 2 to 1000 finite cash flows with at least one inflow and one outflow, equal periods, first flow at time 0; periodsPerYear a whole number 1 to 365, optional. The rate is per period. Several sign changes can give several rates or none, then irr is null (see reason). Not covered: flows at irregular dates (that is XIRR), reinvestment at a different rate (that is MIRR), and a rate outside -99% to +9,900% per period. Use when user asks "what is the IRR of these cash flows?" or "what return does this project earn?". Returns: irr, irrs, unique, signChanges, reason, annualEffectiveRate, periods.

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": {
      "cashFlows": "<cashFlows>"
    },
    "name": "workflow.run_irr"
  }
}

Input Schema

NameRequiredDescriptionDefault
cashFlowsYesCash flow at time 0, 1, 2, ... with at least one negative and one positive value (e.g. [-1000, 300, 400, 500])
periodsPerYearNoOptional: periods per year (12 for monthly flows), 1 to 365, to also return the annual effective rate

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.5/5.0
Behavior4/5

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

Annotations only say readOnly/non-destructive/closed-world; the description adds substantial beyond that: the ln(1+rate) search grid from -99% to +9,900% at 0.2% steps, the ~1e13 upper limit, and that touching-zero roots can be missed. That disclosure of algorithmic limits and possible misses is exactly what a numerical tool needs. It stops short of describing the return payload's shape in depth, but 'Returns:' enumerates the fields, so a 4 rather than a 5.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded and logically ordered (definition, sign-change behavior, search limits, edge cases, exclusions, return fields), but it repeats itself: 'Several sign changes can give several rates or none, then irr is null (see reason)' restates the earlier multi-root paragraph almost verbatim, and 'The rate is per period' appears twice. For a two-parameter tool the text is heavier than it needs to be.

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?

There is no output schema, yet the description names every returned field (irr, irrs, unique, signChanges, reason, annualEffectiveRate, periods) and explains when each reason value fires (unverified, multiple_roots, none_found). Combined with the input bounds and exclusions, nothing an agent needs to call this correctly or interpret the result 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; the description still adds interpretation the schema does not — that periods must be equal, flows finite, first flow at time 0, and that periodsPerYear is a whole number 1–365 used to derive the annual effective rate. The 'rate is per period' framing is the key semantic the schema cannot convey, though it is restated more than once.

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 precise verb-plus-resource definition: 'Internal rate of return: the rate per period at which the NPV of a list of cash flows is zero (first flow at time 0).' It also names adjacent-but-different tools (XIRR for irregular dates, MIRR for different reinvestment) and the sibling family includes run_npv/run_present_value, so an agent can route correctly without opening a schema.

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 trigger phrases ('what is the IRR of these cash flows?', 'what return does this project earn?') plus an explicit 'Not covered' list routing XIRR, MIRR, and out-of-range rates elsewhere. It even warns not to quote a single rate when sign changes exceed one, which is a usage rule, not just behavior.

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.