run_simulation
Run a Monte Carlo simulation on an Excel workbook, control iterations and seed, and save results to a .vmrs file for analysis.
Instructions
ModelRisk: Run a Monte Carlo simulation on the active (or named) workbook and save the results to a .vmrs file. Defaults to 1000 iterations with a fixed seed for reproducibility, and saves the .vmrs next to the workbook as <book>.vmrs. The simulation is run via the same XLL commands ModelRisk's own ribbon uses (VoseStartSimulCustom12 + VoseGetDataSZ12 with the SaveResultsToFile session), so behaviour matches what you'd see clicking 'Simulate' manually. Blocks until the simulation completes. After this returns, call get_simulation_results — the produced .vmrs is automatically pinned as the active results source.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| seed | No | Random seed for reproducibility (fixed seed). | |
| samples | No | Iteration count. Default: 1000. Either `samples` or `iterations` is accepted (they mean the same thing). If both are passed, `samples` wins. | |
| save_to | No | Absolute path to write the .vmrs. Default: next to the workbook as `<book_stem>.vmrs`. For OneDrive-hosted workbooks (where path resolution can fail) the default falls back to the user's Desktop folder. | |
| iterations | No | Alias for `samples`. ModelRisk's UI calls this 'samples'; many users call it 'iterations'. Both work. | |
| workbook_name | No | Workbook file name (e.g. 'model.xlsx'). Omit for the active workbook. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| seed | Yes | ||
| samples | Yes | ||
| next_step | Yes | Suggested follow-up call for the MCP client — typically `get_simulation_results` to pull the per-output statistics. | |
| vmrs_path | Yes | ||
| workbook_name | Yes |