Skip to main content
Glama

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

Npv

workflow.run_npv
Read-only

Net present value of a list of cash flows at a discount rate per period. The first flow is at time 0 and is NOT discounted (the usual textbook NPV; a spreadsheet NPV() function discounts the first value one period, so its result is this one divided by 1 + rate). Money received is positive, money paid is negative. ratePerPeriod must match the spacing of the flows (a monthly rate for monthly flows). To find the rate that makes NPV zero use workflow.run_irr. Edge cases: ratePerPeriod strictly above -1 and at most 1e6, as a fraction per period (0.05 is 5%), not per year; 1 to 1000 cash flows, the first at time 0, all finite; money received is positive and money paid is negative. Not covered: flows at irregular dates (use equal periods), a rate that changes, taxes, inflation, and the choice of discount rate; a positive NPV is arithmetic, not a decision. Use when user asks "is this project worth doing at a 10% cost of capital?" or "what is the NPV of these cash flows?". Returns: npv, discountedFlows, pvOfInflows, pvOfOutflows, undiscountedSum, 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": {
      "ratePerPeriod": "<ratePerPeriod>",
      "cashFlows": "<cashFlows>"
    },
    "name": "workflow.run_npv"
  }
}

Input Schema

NameRequiredDescriptionDefault
cashFlowsYesCash flow at time 0, 1, 2, ... (e.g. [-1000, 500, 500, 500]); use 0 for an empty period
ratePerPeriodYesDiscount rate per period as a fraction (0.1 = 10% per period), above -100%, at most 1e6

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already establish readOnly/no-side-effects, and the description adds genuinely useful behavior beyond them: the exact discounting convention for the time-0 flow, the sign convention for inflows vs outflows, the requirement that ratePerPeriod match flow spacing, validation bounds (-1 < rate <= 1e6, 1..1000 flows, all finite), and the enumerated response fields.

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 dense, but the sign convention ("money received is positive, money paid is negative") is stated twice within a few lines, and the rate bounds repeat the schema verbatim. The content earns most of its space, yet the duplication and list-style repetition of edge cases make it longer than needed.

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 two-parameter read-only calculator with no output schema, the description covers definition, units, sign convention, bounds, sibling routing, and even enumerates the returned fields (npv, discountedFlows, pvOfInflows, pvOfOutflows, undiscountedSum, periods). An agent has everything needed to call it correctly and interpret the result.

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 already 100%, so the per-parameter descriptions carry the basics; the description still adds the spacing-matching rule (monthly rate for monthly flows), the fraction-not-per-year clarification, and the sign convention for cash flow entries. Some of the bounds (above -1, at most 1e6) restate the schema rather than extend it.

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?

Opens with a specific verb+resource+formula: net present value of a list of cash flows at a discount rate per period. It explicitly distinguishes itself from the spreadsheet NPV() convention (first flow at time 0 is not discounted) and names the sibling workflow.run_irr as the inverse operation, so an agent can tell it apart from the ~90 other workflow.run_* tools.

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 phrasings ("is this project worth doing at a 10% cost of capital?", "what is the NPV of these cash flows?"), routes the rate-solving case to workflow.run_irr, and lists exclusions (irregular dates, changing rate, taxes, inflation, choice of discount rate) plus the caution that positive NPV is arithmetic, not a decision.

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.