Skip to main content
Glama

13-Week Cash Flow Forecast

13-Week Cash Flow Forecast

cash_forecast
Read-only

Forecast weekly cash in, cash out and closing balance for 13 weeks with P10 / P50 / P90 ranges, timing receipts by how each customer actually pays. Inputs: ar_open (customer_ref, amount, due_date), ar_history (customer_ref, due_date, paid_date, amount), ap_open (supplier_ref, amount, due_date), payroll, recurring, statutory (gst / tds / pf / esi / advance_tax), fixed_outflows (e.g. loan repayments as fixed amounts), opening_balance, minimum_cash; optional payment_behaviour_snapshot, previous_forecast + actuals, scenarios, explain_week. Returns decision cards, weekly ranges, the probability of falling below minimum_cash and the earliest risky week, drivers of a week, what-if results, accuracy (WAPE, MAPE, bias, Trigg tracking signal) and an updated snapshot. ar_history alone returns days-to-pay per customer. Uses Kaplan-Meier days-to-pay and Monte Carlo. Not for interest, borrowing or investment advice, bank feeds, or accounting entries. Larger ledgers: cash_forecast_get_engine.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "cash_forecast"
  }
}

Input Schema

NameRequiredDescriptionDefault
seedNo
as_ofNoForecast start date (default today); weeks run 7 days from it.
weeksNo
actualsNoActual cash by date or week: date, cash_in, cash_out, closing (or signed amount).
ap_openNoOpen payables: supplier_ref, bill_ref, amount, due_date.
ar_openNoOpen receivables: customer_ref, invoice_ref, amount, due_date (or invoice_date + terms), optional segment. ERP / Tally / Zoho ageing headers are understood.
n_pathsNo
payrollNodate + amount, or schedule (monthly / weekly / fortnightly) + day + amount.
currencyNoINR
new_salesNoExpected new invoices: date (or week), amount, optional customer_ref / segment, terms; timed by behaviour like open invoices.
recurringNoname, amount, schedule (weekly / fortnightly / monthly / quarterly / yearly), day or start date, direction (out default, or in).
scenariosNoWhat-ifs: {type: customer_delay, customer, weeks|days}; {type: supplier_delay, supplier, weeks}; {type: inflow|outflow, amount, week|date, label}; {type: customer_no_pay|customer_on_time, customer}; {type: collections_faster|all_customers_delay, days}.
statutoryNotype (gst, tds, pf, esi, pt, advance_tax, vat, payroll_tax, sales_tax) + amount; dates templated (GST 20th, TDS 7th, PF / ESI 15th, advance tax 15 Jun / Sep / Dec / Mar), or day to override.
ap_historyNoPaid bills: supplier_ref, due_date, paid_date, amount (the company's own days-to-pay; used with 10+ paid bills).
ar_historyNoPayment history: customer_ref, invoice_ref, due_date, paid_date, amount (paid_amount for part payments), optional segment. Include old invoices still open (no paid_date): they count as censored.
date_orderNo
max_listedNo
explain_weekNo
minimum_cashNoCushion to test breach risk against.
fixed_inflowsNodate (or week) + amount + label.
fixed_outflowsNodate (or week) + amount + label, e.g. loan repayments as fixed amounts.
currency_symbolNo
opening_balanceNoCash today.
payables_policyNohistory_or_due
breach_thresholdNo
min_history_daysNo
previous_forecastNoAn earlier run's output (or its weeks list) for accuracy_report.
default_terms_daysNo
shrinkage_strengthNo
payment_behaviour_snapshotNopayment_behaviour_snapshot from an earlier run.

Output Schema

NameRequiredDescriptionDefault
weeksNo
alertsNo
statusYes1 = forecast / report produced, 0 = refused (see decisions)
messageNo
accuracyNo
metadataYes
paymentsNo
customersNo
decisionsYesPlain-language cards, priority order. Relay these first.
scenariosNo
assumptionsNo
breach_riskNo
explain_weekNo
payment_behaviourNo
data_quality_reportNo
payment_behaviour_snapshotNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, destructiveHint=false and closed-world, lowering the burden. The description still adds real behavioural context beyond them: the statistical method (Kaplan-Meier days-to-pay, Monte Carlo), that outputs are probabilistic ranges plus breach probability and earliest risky week, that outputs include an updated snapshot, and that ar_history alone degrades to a days-to-pay calculation. Determinism/seed behaviour and how scenarios interact with the snapshot are left unstated.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with purpose and results before the long input enumeration, with no filler sentences. The inputs block is a dense run-on list, but nearly every element maps to a real parameter or output, so it earns its space despite being hard to scan.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given an output schema exists, the return-value enumeration is bonus rather than required, and the description still covers method, outputs and exclusions. For a 30-parameter, zero-required tool it does not state a minimum viable input set or explain the tuning parameters, which is the main remaining gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 57% across 30 parameters, and the schema's own descriptions for scenarios, statutory, ar_open and ar_history are already detailed. The description mostly re-lists parameter names in groups rather than adding meaning beyond the schema; several parameters (seed, n_paths, breach_threshold, shrinkage_strength, min_history_days, payables_policy, max_listed) get no explanation at all. Baseline 3 is appropriate since the schema carries the substantive semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource with scope: 'Forecast weekly cash in, cash out and closing balance for 13 weeks with P10 / P50 / P90 ranges.' It also names the sibling it hands off to ('Larger ledgers: cash_forecast_get_engine'), so an agent can distinguish it without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives a clear usage boundary ('Not for interest, borrowing or investment advice, bank feeds, or accounting entries') and a routing rule to cash_forecast_get_engine for larger ledgers, plus an alternate mode ('ar_history alone returns days-to-pay per customer'). It stops short of stating which input combinations are minimally required for a useful forecast, so exclusions and alternatives are stated but selection criteria are not fully enumerated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.