Skip to main content
Glama

present_value

Calculate the current worth of future cash flows by applying discount rates over specified time periods.

Instructions

Calculate present value of future cash flows

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
futureValueYes
rateYes
timeYes

Implementation Reference

  • The handler function for the 'present_value' tool. It calculates the present value of a future amount using the formula PV = FV / (1 + r)^t.
    async ({ futureValue, rate, time }) => { return futureValue / Math.pow(1 + rate, time); }
  • Input and output schema definitions for the 'present_value' tool. Inputs: futureValue (number), rate (number), time (number). Output: number.
    inputSchema: z.object({ futureValue: z.number(), rate: z.number(), // discount rate as decimal time: z.number() // years }), outputSchema: z.number(),
  • index.js:222-236 (registration)
    Registration of the 'present_value' tool using ai.defineTool, including name, description, schema, and handler.
    ai.defineTool( { name: 'present_value', description: 'Calculate present value of future cash flows', inputSchema: z.object({ futureValue: z.number(), rate: z.number(), // discount rate as decimal time: z.number() // years }), outputSchema: z.number(), }, async ({ futureValue, rate, time }) => { return futureValue / Math.pow(1 + rate, time); } );

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