Skip to main content
Glama
nbiish
by nbiish

npv

Calculate Net Present Value of cash flows using a specified discount rate to evaluate investment profitability.

Instructions

Calculate Net Present Value of cash flows

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cashFlowsYes
rateYes

Implementation Reference

  • index.js:238-252 (registration)
    Registration of the 'npv' tool using ai.defineTool, including schema and inline handler.
    ai.defineTool(
      {
        name: 'npv',
        description: 'Calculate Net Present Value of cash flows',
        inputSchema: z.object({
          cashFlows: z.array(z.number()),
          rate: z.number() // discount rate as decimal
        }),
        outputSchema: z.number(),
      },
      async ({ cashFlows, rate }) => {
        return cashFlows.reduce((npv, cf, t) => 
          npv + cf / Math.pow(1 + rate, t), 0);
      }
    );
  • Handler function computes Net Present Value by reducing cash flows discounted by the given rate using the time index as the period.
    async ({ cashFlows, rate }) => {
      return cashFlows.reduce((npv, cf, t) => 
        npv + cf / Math.pow(1 + rate, t), 0);
    }
  • Schema definition for 'npv' tool: input requires array of cashFlows and discount rate; output is a number.
    {
      name: 'npv',
      description: 'Calculate Net Present Value of cash flows',
      inputSchema: z.object({
        cashFlows: z.array(z.number()),
        rate: z.number() // discount rate as decimal
      }),
      outputSchema: z.number(),
    },
Behavior1/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. The description only states what the tool calculates without revealing any behavioral traits: it doesn't mention error handling, computational limits, assumptions (e.g., cash flow timing), or output format. For a calculation tool with zero annotation coverage, this is inadequate.

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?

The description is a single, efficient sentence with zero waste. It's appropriately sized for a simple calculation tool and front-loads the core purpose. Every word earns its place, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (financial calculation with 2 parameters), lack of annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects, parameter details, or output expectations. For a tool that performs NPV calculation—which involves assumptions about timing and rate—more context is needed for effective use.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate for undocumented parameters. The description mentions 'cash flows' and implies a rate, but doesn't explain parameter meanings: what cashFlows array represents (e.g., period amounts), what rate is (e.g., discount rate as decimal), or their units. It adds minimal value beyond the schema's structure.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as 'Calculate Net Present Value of cash flows', which is a specific verb ('Calculate') plus resource ('Net Present Value of cash flows'). It distinguishes from siblings like 'present_value' by specifying NPV calculation, though it doesn't explicitly contrast them. The purpose is unambiguous but could be more differentiated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'present_value', 'compound_interest', and 'black_scholes' available, there's no indication of when NPV calculation is appropriate versus other financial calculations. The description lacks any context about use cases or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nbiish/mcp-calc-tools'

If you have feedback or need assistance with the MCP directory API, please join our Discord server