Skip to main content
Glama

expense_cash_flow_impact

Analyze how pending expenses affect future cash flow over a specified period to forecast financial impact and support budgeting decisions.

Instructions

Analyze cash flow impact of pending expenses

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daysAheadNo

Implementation Reference

  • The JavaScript handler function for the 'expense_cash_flow_impact' tool, which calls the Python ExpenseTracker.cash_flow_impact method via the PythonBridge.
    handler: async (args: any): Promise<ToolResult> => { try { const result = await pythonBridge.callPythonFunction({ module: 'expense_tracking', function: 'ExpenseTracker.cash_flow_impact', args: [args.daysAhead || 30] }); return result; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } }
  • Input schema defining the optional 'daysAhead' parameter (defaults to 30 days) for analyzing cash flow impact.
    inputSchema: { type: "object", properties: { daysAhead: { type: "number", default: 30 } } },
  • Tool registration within the expenseTools array, including name, description, input schema, and handler.
    { name: "expense_cash_flow_impact", description: "Analyze cash flow impact of pending expenses", inputSchema: { type: "object", properties: { daysAhead: { type: "number", default: 30 } } }, handler: async (args: any): Promise<ToolResult> => { try { const result = await pythonBridge.callPythonFunction({ module: 'expense_tracking', function: 'ExpenseTracker.cash_flow_impact', args: [args.daysAhead || 30] }); return result; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } } },
  • Core Python implementation in ExpenseTracker class that calculates cash flow impact by analyzing pending expenses, expected payment dates based on vendor terms, and projecting outflows over the specified period.
    def cash_flow_impact(self, days_ahead: int = 30) -> Dict[str, float]: """Analyze cash flow impact of pending expenses""" today = date.today() future_date = today + timedelta(days=days_ahead) # Pending approvals pending_expenses = [ e for e in self.expenses if e.approval_status in [ApprovalStatus.PENDING, ApprovalStatus.APPROVED] and e.paid_date is None ] # Group by expected payment date cash_flow = {} for expense in pending_expenses: vendor = self.vendors.get(expense.vendor_id) if vendor: # Calculate expected payment date based on terms terms_days = 30 # Default if vendor.payment_terms == "Net 15": terms_days = 15 elif vendor.payment_terms == "Net 45": terms_days = 45 elif vendor.payment_terms == "Due on Receipt": terms_days = 0 expected_payment = expense.date + timedelta(days=terms_days) if expected_payment <= future_date: week_key = expected_payment.strftime('%Y-W%V') if week_key not in cash_flow: cash_flow[week_key] = 0 cash_flow[week_key] += expense.amount return { 'weekly_outflows': cash_flow, 'total_pending': sum(e.amount for e in pending_expenses), 'next_30_days': sum(cash_flow.values()), 'overdue': sum(e.amount for e in pending_expenses if e.date < today - timedelta(days=30)) }
  • src/index.ts:32-44 (registration)
    Central registration where expenseTools (including expense_cash_flow_impact) is combined into allTools array used by the MCP server for 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