Skip to main content
Glama

NPV and IRR

npv_irr
Read-onlyIdempotent

Standard precision: this calculator uses ordinary floating-point arithmetic, keeps no dated table of official rates, and has not yet passed our full reference-test suite. Compute Net Present Value (NPV), Internal Rate of Return (IRR) via iterative Newton-Raphson polynomial convergence, and discounted payback period for capital budgeting and investment appraisal.

Behavior: Deterministic, idempotent calculation with zero external side effects. Evaluates NPV = -C0 + sum(Ct / (1 + r)^t). Computes exact IRR by finding the discount rate where NPV equals zero using up to 100 Newton-Raphson iterations with tolerance 1e-7. Returns NPV, IRR percentage, profitability index (PI), and payback period in periods/years.

Usage Guidelines: Use for evaluating capital investments, M&A valuations, corporate projects, and multi-year cash flow hurdle rates. Do not use for simple compound interest projections with fixed monthly deposits; use compound_wealth instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cashflowsYesSeries of sequential periodic net cash inflows starting from period 1 onwards. Minimum 1 cash flow required.
initialInvestmentYesUpfront initial capital outlay at period 0 in currency units. Entered as a positive number (treated as cash outflow). Must be positive.
discountRatePercentNoAnnual cost of capital or hurdle discount rate percentage (e.g. 10.0 for 10%).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • removedInput schema / properties / initialInvestment / default
      Removed value: -100000
  2. Changed4 schema fields changed
    • changedInput schema / properties / cashflows / description
      Previous value: -"Series of sequential cash inflows ($)"New value: +"Series of sequential periodic net cash inflows starting from period 1 onwards. Minimum 1 cash flow required."
    • addedInput schema / properties / cashflows / items / description
      Added value: +"Net cash inflow amount for this sequential period in currency units."
    • changedInput schema / properties / discountRatePercent / description
      Previous value: -"Annual hurdle / discount rate %"New value: +"Annual cost of capital or hurdle discount rate percentage (e.g. 10.0 for 10%)."
    • changedInput schema / properties / initialInvestment / description
      Previous value: -"Initial capital outlay / outflow at period 0 ($)"New value: +"Upfront initial capital outlay at period 0 in currency units. Entered as a positive number (treated as cash outflow). Must be positive."
  3. Added

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint; the description adds meaningful context beyond that: deterministic behavior, zero external side effects, the Newton-Raphson iteration count/tolerance, and the warning about standard precision and unpassed reference tests. This is rich behavioral disclosure.

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

Conciseness5/5

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

Three tight paragraphs: caveat first, then behavior/formula, then usage. Every sentence carries information (precision warning, algorithm detail, return values, sibling exclusions) with no filler. Efficient for the tool's complexity.

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 tool with no output schema, the description explicitly lists returned values (NPV, IRR percentage, PI, payback period) and explains input meaning. Combined with 100% schema coverage, it covers what an agent needs to call and interpret results.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so all three parameters are already documented. The description repeats the NPV formula but adds no new parameter semantics beyond the schema. Baseline 3 applies because the schema does the heavy lifting.

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 ('Compute') and resource (NPV, IRR, discounted payback period), and explicitly differentiates from the sibling compound_wealth by naming the alternative use case. An agent can tell this is for capital budgeting rather than simple interest compounding without opening other schemas.

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?

Provides explicit when-to-use scenarios ('capital investments, M&A valuations...') and a direct when-not-to-use directive ('Do not use for simple compound interest projections... use compound_wealth instead'). No inference needed.

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