Skip to main content
Glama

cash_burn_analysis

Calculate cash burn rate and runway to determine financial sustainability and forecast remaining operational funds.

Instructions

Analyze cash burn rate and calculate runway

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
monthsBackNo

Implementation Reference

  • MCP tool handler for cash_burn_analysis that invokes the Python function via PythonBridge
    handler: async (args: any): Promise<ToolResult> => { try { const result = await pythonBridge.callPythonFunction({ module: 'cash_flow_tools', function: 'cash_burn_analysis', args: [args.monthsBack || 6] }); return result; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } }
  • Input schema for the cash_burn_analysis tool, accepting optional monthsBack parameter (default 6)
    inputSchema: { type: "object", properties: { monthsBack: { type: "number", default: 6 } } },
  • Wrapper function in cash_flow_tools.py that instantiates CashFlowAnalyzer and calls its cash_burn_analysis method
    def cash_burn_analysis(months_back: int = 6) -> Dict[str, Any]: """Analyze cash burn rate and runway""" from cash_flow_analysis import CashFlowAnalyzer analyzer = CashFlowAnalyzer() return analyzer.cash_burn_analysis(months_back)
  • Core implementation of cash_burn_analysis in CashFlowAnalyzer class, calculating burn rate, runway, trends, and recommendations
    def cash_burn_analysis(self, months_back: int = 6) -> Dict: """Analyze cash burn rate and runway""" end_date = date.today() start_date = end_date - timedelta(days=30 * months_back) monthly_flows = {} # Group flows by month for cf in self.cash_flows: if start_date <= cf.date <= end_date: month_key = cf.date.strftime('%Y-%m') if month_key not in monthly_flows: monthly_flows[month_key] = {'inflows': 0, 'outflows': 0} if cf.direction == CashFlowDirection.INFLOW: monthly_flows[month_key]['inflows'] += cf.amount else: monthly_flows[month_key]['outflows'] += cf.amount # Calculate burn rates monthly_burns = [] for month, flows in monthly_flows.items(): net_burn = flows['outflows'] - flows['inflows'] monthly_burns.append({ 'month': month, 'inflows': flows['inflows'], 'outflows': flows['outflows'], 'net_burn': net_burn }) if not monthly_burns: return {'error': 'No cash flow data found'} df = pd.DataFrame(monthly_burns) average_burn = df['net_burn'].mean() current_cash = self.opening_balance + sum( cf.amount * (1 if cf.direction == CashFlowDirection.INFLOW else -1) for cf in self.cash_flows ) # Calculate runway runway_months = current_cash / average_burn if average_burn > 0 else float('inf') # Trend analysis if len(monthly_burns) >= 3: recent_3_months = df.tail(3)['net_burn'].mean() trend = 'Improving' if recent_3_months < average_burn else 'Worsening' else: trend = 'Insufficient Data' return { 'current_cash_balance': round(current_cash, 2), 'average_monthly_burn': round(average_burn, 2), 'runway_months': round(runway_months, 1) if runway_months != float('inf') else 'Infinite', 'trend': trend, 'monthly_detail': monthly_burns, 'burn_rate_volatility': round(df['net_burn'].std(), 2), 'recommendation': self._get_burn_recommendation(runway_months, trend) }

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