Monte Carlo Simulation
workflow.run_monte_carloMonte Carlo simulation of a portfolio: geometric Brownian motion with a contribution (or withdrawal) at the end of every step, up to 10,000 paths (paths x steps at most 5 million), deterministic for a given seed. Returns the spread of final values (percentiles 5 to 95, mean with its standard error and the exact expected value, probability of ending below the net amount invested, probability of ending a step at or below a ruin level) and a fan of 5th, 50th and 95th percentile bands over time, instead of one number. A value that would go below zero is floored at zero. Constant return and volatility, no fees or taxes: a model of spread, not a forecast. Edge cases: initialValue 0 to 1e12 (0 needs a positive contribution); contributionPerStep -1e12 to 1e12 (negative is a withdrawal, paid at the end of each step); annualReturnPct -100 to 500; volatilityPct 0 to 500; years above 0 and at most 50; stepsPerYear a whole number 1 to 365; years times stepsPerYear a whole number of at most 18,250; paths a whole number 100 to 10,000 and paths times steps at most 5,000,000; seed a whole number (default 1, the same seed gives the same result). Not covered: fat tails and volatility clustering (returns are lognormal), taxes, inflation, fees, sequence-of-returns beyond the simulated model, and any forecast. Use when user asks "what range of outcomes can my portfolio end in", "how likely is it that I run out of money withdrawing X a month" or "simulate my savings plan".
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"initialValue": "<initialValue>",
"annualReturnPct": "<annualReturnPct>",
"volatilityPct": "<volatilityPct>",
"years": "<years>"
},
"name": "workflow.run_monte_carlo"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| seed | No | Random seed, 0 to 4294967295; the same input and seed give the same result. Default 1. | |
| paths | No | Simulated paths, 100 to 10000 (paths x steps at most 5 million). Default 2000. | |
| years | Yes | Horizon in years, above 0 and at most 50. years x stepsPerYear must be a whole number. | |
| ruinBelow | No | A path counts as ruined once it ends a step at or below this value. Default 0. | |
| initialValue | Yes | Starting value, 0 to 1e12. 0 is allowed only with a positive contribution. | |
| stepsPerYear | No | Steps (and contributions) per year, 1 to 365. Default 12. | |
| volatilityPct | Yes | Annual volatility sigma in percentage points, 0 to 500. | |
| annualReturnPct | Yes | Expected growth mu in percentage points per year, -100 to 500. | |
| contributionPerStep | No | Added at the END of every step; negative is a withdrawal. Default 0. |