cash_flow_forecast
Forecast future cash flows with scenario analysis to model financial outcomes under different conditions for better decision-making.
Instructions
Forecast future cash flows with scenario analysis
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| monthsAhead | No | ||
| scenarios | No |
Implementation Reference
- src/tools/cash-flow-tools.ts:52-67 (handler)The handler function that executes the cash_flow_forecast tool by calling the Python module 'cash_flow_tools' function 'forecast_cash_flow' via PythonBridge.handler: async (args: any): Promise<ToolResult> => { try { const result = await pythonBridge.callPythonFunction({ module: 'cash_flow_tools', function: 'forecast_cash_flow', args: [args.monthsAhead || 12, args.scenarios] }); return result; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } } },
- src/tools/cash-flow-tools.ts:38-51 (schema)Input schema for validating arguments to the cash_flow_forecast tool: monthsAhead (default 12) and scenarios object with base, conservative, optimistic multipliers.inputSchema: { type: "object", properties: { monthsAhead: { type: "number", default: 12 }, scenarios: { type: "object", properties: { base: { type: "number", default: 1.0 }, conservative: { type: "number", default: 0.9 }, optimistic: { type: "number", default: 1.1 } } } } },
- src/index.ts:32-44 (registration)Server-wide registration: cashFlowTools (including cash_flow_forecast) is spread into the allTools array used for ListTools and CallTool handlers.const allTools = [ ...excelTools, ...financialTools, ...rentalTools, ...expenseTools, ...reportingTools, ...cashFlowTools, ...taxTools, ...analyticsTools, ...chartTools, ...complianceTools, ...propertyTools, ];
- src/python/cash_flow_tools.py:20-28 (helper)Supporting Python function implementing the core forecasting logic, invoked by the TS handler via bridge. Delegates to CashFlowAnalyzer.def forecast_cash_flow(months_ahead: int = 12, scenarios: Optional[Dict[str, float]] = None) -> List[Dict]: """Forecast cash flows with scenario analysis""" from cash_flow_analysis import CashFlowAnalyzer analyzer = CashFlowAnalyzer() result = analyzer.forecast_cash_flow(months_ahead, scenarios) return result.to_dict('records') if hasattr(result, 'to_dict') else []