Skip to main content
Glama

effective_annual_rate

Calculate the effective annual interest rate from a nominal rate and compounding frequency to accurately compare investment returns or loan costs.

Instructions

Calculate effective annual rate from nominal rate

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
compoundingPeriodsYesNumber of compounding periods per year
nominalRateYesNominal annual rate as decimal

Implementation Reference

  • Handler function that executes the tool by calling the Python FinancialCalculator.effective_annual_rate via the Python bridge.
    handler: async (args: any): Promise<ToolResult> => { try { const result = await pythonBridge.callPythonFunction({ module: 'financial_calculations', function: 'FinancialCalculator.effective_annual_rate', args: [args.nominalRate, args.compoundingPeriods] }); return result; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } }
  • Input schema defining the parameters nominalRate (float) and compoundingPeriods (int) for the tool.
    inputSchema: { type: "object", properties: { nominalRate: { type: "number", description: "Nominal annual rate as decimal" }, compoundingPeriods: { type: "number", description: "Number of compounding periods per year" } }, required: ["nominalRate", "compoundingPeriods"] },
  • Full tool registration object added to the financialTools array, which is imported and spread into the main MCP tools list.
    { name: "effective_annual_rate", description: "Calculate effective annual rate from nominal rate", inputSchema: { type: "object", properties: { nominalRate: { type: "number", description: "Nominal annual rate as decimal" }, compoundingPeriods: { type: "number", description: "Number of compounding periods per year" } }, required: ["nominalRate", "compoundingPeriods"] }, handler: async (args: any): Promise<ToolResult> => { try { const result = await pythonBridge.callPythonFunction({ module: 'financial_calculations', function: 'FinancialCalculator.effective_annual_rate', args: [args.nominalRate, args.compoundingPeriods] }); return result; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } } },
  • Core helper function implementing the effective annual rate formula: (1 + r/n)^n - 1.
    @staticmethod def effective_annual_rate(nominal_rate: float, compounding_periods: int) -> float: """Calculate effective annual rate (EAR)""" return ((1 + nominal_rate / compounding_periods) ** compounding_periods) - 1

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/jeremycharlesgillespie/excel-mcp'

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