← All engines

RUST ENGINE / compute_cashflow_metrics

Net present value and internal rate of return of dated cash flows

Compute the net present value and the internal rate of return of 2 to 360 dated cash flows, with the Actual/365 Fixed day count of spreadsheet XNPV and XIRR. The tool says when no rate exists or when several may exist.

In short. compute_cashflow_metrics is a ScoreCompute MCP tool computed in Rust (Cash-flow metrics). Provide flows: 2 to 360 entries, each with a date (YYYY-MM-DD, from 1900-01-01 to 2200-12-31) and a signed amount in one currency, negative when paid out and positive when received, within ±1e12. Arithmetic on the supplied figures only: no currency conversion, no tax, fee or inflation rule, no amortization schedule, and not financial advice. It is callable at https://scorecompute.com/mcp over MCP Streamable HTTP, without an API key for bounded public access.

Open the compute_cashflow_metrics demonstration ↗Try the live calculation ↗Connect an AI assistant →

What does a real call return?

For 5 dated flows over 456 days, the net present value at an annual rate of 9% is 2086.65. The status is unique_root: the internal rate of return is 37.34% per year, the only rate above −100% for these flows, found in 13 evaluations. Independent check: the spreadsheet documentation linked below lists 2,086.65 and 37.34% for the same flows (read on 23 November 2026).

Recorded on 23 November 2026 through the public MCP endpoint, service release 0.18.0. Inputs and full responses, response SHA-256 def45541856e…. Verdict values are the literal values the tool returns. Run the same inputs yourself to compare; elapsed times vary, and a new release may change the figures.

Checked against

Recorded on release 0.18.0. These checks cover the listed cases, not every input. Evidence cards.

How it works

NPV(r) is the sum of amount / (1 + r)^(days since the earliest date / 365), with r an annual effective rate and the Actual/365 Fixed day count documented for spreadsheet XNPV. The internal rate of return is a rate above −100% at which the NPV is zero. The sign changes of the net amounts per date, in date order, bound how many such rates exist (Descartes’ rule of signs for real exponents). A bracketed search refined by Brent’s method, with at most 200 iterations per bracket, looks for rates between −99.99% and +999,900% per year. A rate is reported as the internal rate of return only when it is provably the only one and the search converged.

Inputs and units

Provide flows: 2 to 360 entries, each with a date (YYYY-MM-DD, from 1900-01-01 to 2200-12-31) and a signed amount in one currency, negative when paid out and positive when received, within ±1e12. Optionally provide discount_rate, an annual effective rate as a fraction from −0.99 to 100 (0.08 means 8% per year); omit it to skip the NPV.

What the result contains

The flow count, date span in days, net total and sign changes; the NPV at the stated rate, or null when no rate is supplied; irr_status (unique_root, no_sign_change, all_flows_zero, multiple_roots_possible, root_outside_search_range or not_converged); the rate when it is unique; the candidate rates found with their residuals; the search bounds and work; and a plain statement of the result.

Example MCP call

{
  "name": "compute_cashflow_metrics",
  "arguments": {
    "flows": [
      {
        "date": "2008-01-01",
        "amount": -10000
      },
      {
        "date": "2008-03-01",
        "amount": 2750
      },
      {
        "date": "2008-10-30",
        "amount": 4250
      },
      {
        "date": "2009-02-15",
        "amount": 3250
      },
      {
        "date": "2009-04-01",
        "amount": 2750
      }
    ],
    "discount_rate": 0.09
  }
}

Send this tool name and arguments through a connected MCP client. Discover the authoritative input schema with tools/list.

Call this engine in one command

Node.js 20+ and npm. This downloads a small remote MCP client; it does not install the engine locally.

npx --yes --package https://scorecompute.com/downloads/scorecompute-call-0.14.2.tgz scorecompute-call compute_cashflow_metrics --arguments '{"flows":[{"date":"2008-01-01","amount":-10000},{"date":"2008-03-01","amount":2750},{"date":"2008-10-30","amount":4250},{"date":"2009-02-15","amount":3250},{"date":"2009-04-01","amount":2750}],"discount_rate":0.09}'

Client download, PowerShell input and verification →

Direct MCP access

compute_cashflow_metrics is independently callable. It is deliberately not connected to the automatic planner, so nothing passes its results to another engine for you. Two tools returning similar JSON fields does not mean their results are compatible.

Cite this engine

Version 0.1.0, source SHA-256 9adff89a5809…. Evidence recorded on release 0.18.0; the public service currently runs 0.18.0. Replace the access date when you cite it.

ScoreCompute. Net present value and internal rate of return of dated cash flows (compute_cashflow_metrics), version 0.1.0, source SHA-256 9adff89a5809e8815bd6dbf49731be38d2e17bd096c1558e180f037d5635ac19. Evidence release 0.18.0, service release 0.18.0. https://scorecompute.com/engines/compute-cashflow-metrics/ (accessed YYYY-MM-DD).

All engine citations · Evidence card

Execution and availability

ScoreCompute exposes this tool through MCP Streamable HTTP. Rust computation runs on a connected worker; the public website and MCP gateway run separately. Among these 24 scientific tools, CUDA is implemented for simulate_pi; the other scientific engines run on CPU. The separate contributor network runs two compiled public workloads: a π estimate and fixed synthetic schedule probes. Requests are bounded and concurrent work may be refused when capacity is occupied.

Record inputs, assumptions and returned provenance when sharing a result. The public observatory displays software client names and tool activity, without publishing calculation arguments or results.

Explore another engine →Agent-readable overview ↗

Sources

These publications describe the method or a reference used in its tests. Citing them does not certify this implementation.

First published 23 November 2026 · Last updated 23 November 2026