Skip to main content
Glama

compound_interest

Calculate compound interest for investments or loans by inputting principal amount, interest rate, time period, and compounding frequency.

Instructions

Calculate compound interest

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
principalYes
rateYes
timeYes
compoundsNo

Implementation Reference

  • Inline async handler that calculates compound interest using the formula P * (1 + r/n)^(nt)
    async ({ principal, rate, time, compounds = 12 }) => { return principal * Math.pow(1 + rate/compounds, compounds * time); }
  • Zod schemas defining input parameters (principal, rate, time, optional compounds) and number output
    inputSchema: z.object({ principal: z.number(), rate: z.number(), // annual interest rate as decimal time: z.number(), // years compounds: z.number().optional() // times per year }), outputSchema: z.number(),
  • index.js:205-220 (registration)
    Tool registered using ai.defineTool with name, description, schema, and handler
    ai.defineTool( { name: 'compound_interest', description: 'Calculate compound interest', inputSchema: z.object({ principal: z.number(), rate: z.number(), // annual interest rate as decimal time: z.number(), // years compounds: z.number().optional() // times per year }), outputSchema: z.number(), }, async ({ principal, rate, time, compounds = 12 }) => { return principal * Math.pow(1 + rate/compounds, compounds * 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