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
| Name | Required | Description | Default |
|---|---|---|---|
| futureValue | Yes | ||
| rate | Yes | ||
| time | Yes |
Implementation Reference
- index.js:233-235 (handler)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); }
- index.js:226-231 (schema)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); } );