Irr
workflow.run_irrInternal 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
| Name | Required | Description | Default |
|---|---|---|---|
| cashFlows | Yes | Cash flow at time 0, 1, 2, ... with at least one negative and one positive value (e.g. [-1000, 300, 400, 500]) | |
| periodsPerYear | No | Optional: periods per year (12 for monthly flows), 1 to 365, to also return the annual effective rate |