Skip to main content
Glama
nbiish
by nbiish

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);
      }
    );
Behavior1/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Calculate compound interest' reveals nothing about the tool's behavior - it doesn't specify whether this is a read-only calculation, what format the output takes, whether it handles edge cases, or any computational characteristics. This is inadequate for a tool with 4 parameters.

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 extremely concise at just two words, with no wasted language. It's front-loaded with the core purpose, though this brevity comes at the cost of completeness. Every word earns its place in communicating the basic function.

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

Completeness1/5

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

Given the complexity of a financial calculation tool with 4 parameters, no annotations, no output schema, and 0% schema description coverage, the description is completely inadequate. It doesn't explain what the tool returns, how to interpret results, parameter requirements, or any context needed for proper use.

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

Parameters1/5

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

With 0% schema description coverage and 4 parameters (principal, rate, time, compounds), the description provides no information about what these parameters mean, their units, valid ranges, or relationships. 'Calculate compound interest' doesn't even mention that parameters exist, let alone explain their semantics.

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

Purpose3/5

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

The description 'Calculate compound interest' clearly states the verb ('calculate') and resource ('compound interest'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'present_value' or 'npv' that also perform financial calculations, leaving room for confusion about when to use this specific tool.

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 sibling tools like 'present_value' and 'npv' that handle related financial calculations, there's no indication of when compound interest calculation is preferred or what specific scenarios it addresses.

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