Skip to main content
Glama

calculate_mirr

Calculate Modified Internal Rate of Return using finance and reinvestment rates for accurate investment analysis and cash flow evaluation.

Instructions

Calculate Modified Internal Rate of Return

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cashFlowsYes
financeRateYesFinance rate for negative cash flows
reinvestRateYesReinvestment rate for positive cash flows

Implementation Reference

  • TypeScript handler for calculate_mirr tool that proxies arguments to Python's FinancialCalculator.mirr via PythonBridge.
    handler: async (args: any): Promise<ToolResult> => { try { const result = await pythonBridge.callPythonFunction({ module: 'financial_calculations', function: 'FinancialCalculator.mirr', args: [args.cashFlows, args.financeRate, args.reinvestRate] }); return result; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } }
  • Core Python implementation of the MIRR calculation using numpy_financial.mirr.
    @staticmethod def mirr(cash_flows: List[float], finance_rate: float, reinvest_rate: float) -> float: """Calculate Modified Internal Rate of Return""" return float(npf.mirr(cash_flows, finance_rate, reinvest_rate))
  • Input schema defining the parameters for the calculate_mirr tool.
    inputSchema: { type: "object", properties: { cashFlows: { type: "array", items: { type: "number" } }, financeRate: { type: "number", description: "Finance rate for negative cash flows" }, reinvestRate: { type: "number", description: "Reinvestment rate for positive cash flows" } }, required: ["cashFlows", "financeRate", "reinvestRate"] },
  • Full tool registration object for calculate_mirr within the financialTools array.
    { name: "calculate_mirr", description: "Calculate Modified Internal Rate of Return", inputSchema: { type: "object", properties: { cashFlows: { type: "array", items: { type: "number" } }, financeRate: { type: "number", description: "Finance rate for negative cash flows" }, reinvestRate: { type: "number", description: "Reinvestment rate for positive cash flows" } }, required: ["cashFlows", "financeRate", "reinvestRate"] }, handler: async (args: any): Promise<ToolResult> => { try { const result = await pythonBridge.callPythonFunction({ module: 'financial_calculations', function: 'FinancialCalculator.mirr', args: [args.cashFlows, args.financeRate, args.reinvestRate] }); return result; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } }
  • src/index.ts:32-44 (registration)
    Inclusion of financialTools (containing calculate_mirr) into the allTools array used for MCP tool listing and execution.
    const allTools = [ ...excelTools, ...financialTools, ...rentalTools, ...expenseTools, ...reportingTools, ...cashFlowTools, ...taxTools, ...analyticsTools, ...chartTools, ...complianceTools, ...propertyTools, ];

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