calculate_wacc
Calculate the weighted average cost of capital for investment analysis and financial decision making using equity, debt, cost parameters, and tax rate inputs.
Instructions
Calculate Weighted Average Cost of Capital
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| costOfDebt | Yes | ||
| costOfEquity | Yes | ||
| debtValue | Yes | ||
| equityValue | Yes | ||
| taxRate | Yes |
Implementation Reference
- src/tools/financial-tools.ts:157-186 (registration)Tool definition and registration in financialTools array, including input schema and handler that calls Python implementation{ name: "calculate_wacc", description: "Calculate Weighted Average Cost of Capital", inputSchema: { type: "object", properties: { equityValue: { type: "number" }, debtValue: { type: "number" }, costOfEquity: { type: "number" }, costOfDebt: { type: "number" }, taxRate: { type: "number" } }, required: ["equityValue", "debtValue", "costOfEquity", "costOfDebt", "taxRate"] }, handler: async (args: any): Promise<ToolResult> => { try { const result = await pythonBridge.callPythonFunction({ module: 'financial_calculations', function: 'FinancialCalculator.wacc', args: [args.equityValue, args.debtValue, args.costOfEquity, args.costOfDebt, args.taxRate] }); return result; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } } },
- Core implementation of WACC calculation using weighted average of cost of equity and after-tax cost of debtdef wacc(equity_value: float, debt_value: float, cost_of_equity: float, cost_of_debt: float, tax_rate: float) -> float: """Calculate Weighted Average Cost of Capital""" total_value = equity_value + debt_value equity_weight = equity_value / total_value debt_weight = debt_value / total_value return (equity_weight * cost_of_equity) + (debt_weight * cost_of_debt * (1 - tax_rate))
- src/index.ts:32-44 (registration)Aggregation of all tools including financialTools into allTools array used for MCP server tool listing and executionconst allTools = [ ...excelTools, ...financialTools, ...rentalTools, ...expenseTools, ...reportingTools, ...cashFlowTools, ...taxTools, ...analyticsTools, ...chartTools, ...complianceTools, ...propertyTools, ];
- src/tools/financial-tools.ts:160-170 (schema)Input schema defining parameters for calculate_wacc toolinputSchema: { type: "object", properties: { equityValue: { type: "number" }, debtValue: { type: "number" }, costOfEquity: { type: "number" }, costOfDebt: { type: "number" }, taxRate: { type: "number" } }, required: ["equityValue", "debtValue", "costOfEquity", "costOfDebt", "taxRate"] },