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%).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
npvNo
isViableNo
scheduleNo
irrPercentNo
netCashflowNo
paybackYearsNo
totalInflowsNo
initialInvestmentNo
profitabilityIndexNo
discountRatePercentNo
discountedPaybackYearsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "properties": {
      +    "discountRatePercent": {
      +      "type": [
      +        "string",
      +        "number",
      +        "null"
      +      ]
      +    },
      +    "discountedPaybackYears": {
      +      "type": [
      +        "string",
      +        "number",
      +        "null"
      +      ]
      +    },
      +    "initialInvestment": {
      +      "type": [
      +        "string",
      +        "number",
      +        "null"
      +      ]
      +    },
      +    "irrPercent": {
      +      "type": [
      +        "string",
      +        "number",
      +        "null"
      +      ]
      +    },
      +    "isViable": {
      +      "type": [
      +        "boolean",
      +        "null"
      +      ]
      +    },
      +    "netCashflow": {
      +      "type": [
      +        "string",
      +        "number",
      +        "null"
      +      ]
      +    },
      +    "npv": {
      +      "type": [
      +        "string",
      +        "number",
      +        "null"
      +      ]
      +    },
      +    "paybackYears": {
      +      "type": [
      +        "string",
      +        "number",
      +        "null"
      +      ]
      +    },
      +    "profitabilityIndex": {
      +      "type": [
      +        "string",
      +        "number",
      +        "null"
      +      ]
      +    },
      +    "schedule": {
      +      "type": [
      +        "array",
      +        "null"
      +      ]
      +    },
      +    "totalInflows": {
      +      "type": [
      +        "string",
      +        "number",
      +        "null"
      +      ]
      +    }
      +  },
      +  "type": "object"
      +}
  2. Changed1 schema field changed
    • removedInput schema / properties / initialInvestment / default
      Removed value: -100000
  3. 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."
  4. Added

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false, and openWorldHint=false, so the restated 'deterministic, idempotent... zero external side effects' sentence earns no credit. What does add value is the method transparency (Newton-Raphson with up to 100 iterations, tolerance 1e-7), the exact NPV formula, and the honest precision caveat that it uses plain floating-point and hasn't passed the full reference-test suite.

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?

Bold-labelled sections (Behavior, Usage Guidelines) make it scannable, and the usage contract is tight. It is slightly padded — the leading precision disclaimer sits ahead of the purpose statement, and the behavioral sentence partly restates annotations.

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?

An output schema exists, so return values needn't be spelled out, yet the description still names them (NPV, IRR percentage, PI, payback period). Combined with formula, convergence behavior, precision caveat, and a routing alternative, an agent has everything needed to call this correctly.

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 the schema already explains initialInvestment, cashflows, and discountRatePercent semantics and units. The description adds conceptual context (rate where NPV equals zero) but no parameter-level syntax or format detail beyond the schema, so baseline 3 applies.

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 specific verbs and resources: 'Compute Net Present Value (NPV), Internal Rate of Return (IRR)... and discounted payback period' for capital budgeting. This clearly differentiates it from sibling compound_wealth, which it names explicitly for a different use case.

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 when-to-use contexts ('capital investments, M&A valuations, corporate projects, and multi-year cash flow hurdle rates') and an explicit exclusion with the alternative ('Do not use for simple compound interest projections with fixed monthly deposits; use compound_wealth instead').

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