ModelRisk
v0.4.5Read, build, fit, and run Monte Carlo risk models in Excel through Vose Software's ModelRisk.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
list_open_workbooks
ModelRisk: List all Excel workbooks currently open.
get_active_workbook
ModelRisk: Get the name and path of the active workbook.
open_workbook
ModelRisk: Open a workbook (.xlsx/.xlsm) from disk in the running Excel so the other tools can act on it. Pass an absolute file path. If a workbook with the same file name is already open, returns that one (Excel won't open two with the same name). Requires Excel running.
| Parameter | Type | Description |
|---|---|---|
path * | string | Absolute path to the workbook file, e.g. r'C:\models\risk.xlsx'. |
close_workbook
ModelRisk: Close an open workbook by file name. By DEFAULT unsaved changes are DISCARDED (save=False) — pass save=True to write them first. Returns the closed name and the workbooks still open. Raises if the named workbook isn't open.
| Parameter | Type | Description |
|---|---|---|
workbook_name * | string | File name of an open workbook, e.g. 'risk.xlsx'. |
save | boolean | Save before closing. False (default) discards unsaved changes. |
get_workbook_summary
ModelRisk: Aggregated summary of a workbook — sheet names plus counts of VoseInput, VoseOutput, distribution, formula, and numeric cells. One-shot alternative to running the individual list tools.
| Parameter | Type | Description |
|---|---|---|
workbook_name * | string | Workbook file name (e.g. 'model.xlsx'). |
list_modelrisk_inputs
ModelRisk: List every cell wrapped with VoseInput() in the workbook. Returns each cell's reference, the input name, the full formula, and the current calculated value.
| Parameter | Type | Description |
|---|---|---|
workbook_name * | string |
list_modelrisk_outputs
ModelRisk: List every cell wrapped with VoseOutput() in the workbook.
| Parameter | Type | Description |
|---|---|---|
workbook_name * | string |
list_distributions
ModelRisk: List every cell containing a Vose distribution / aggregate / copula / time-series / fitting function. Includes flags for whether each cell is also wrapped with VoseInput or VoseOutput. Optional `sheet` restricts the scan to one sheet.
| Parameter | Type | Description |
|---|---|---|
workbook_name * | string | |
sheet |
get_cell
ModelRisk: Read a single cell's formula, value, and number format.
| Parameter | Type | Description |
|---|---|---|
cell * | string | A1-style cell reference like 'B12'. |
sheet * | string | |
workbook_name * | string |
read_range
ModelRisk: Read a contiguous range as a 2D array of values and formulas. Use ranges like 'A1:C10'.
| Parameter | Type | Description |
|---|---|---|
range_ref * | string | A1-style range like 'A1:C10'. |
sheet * | string | |
workbook_name * | string |
get_simulation_results
ModelRisk: Read simulation result statistics for the workbook's outputs. Returns per-output mean, stdev, variance, skewness, kurtosis, min, max, and P5/P10/P25/P50/P75/P90/P95 percentiles. Requires a simulation to have been run; pass output_names to filter.
| Parameter | Type | Description |
|---|---|---|
workbook_name * | string | |
output_names |
get_correlation_matrix
ModelRisk: Pearson and Spearman rank correlation between the named simulation inputs and outputs. Computed from the per-iteration samples ModelRisk records. Pass a name list to restrict; otherwise all variables are included.
| Parameter | Type | Description |
|---|---|---|
workbook_name * | string | |
name_list |
get_sensitivity_ranking
ModelRisk: Tornado / sensitivity ranking for a single output. Returns each input ranked by its Spearman rank correlation with the output, plus the standardised regression coefficient.
| Parameter | Type | Description |
|---|---|---|
output_name * | string | |
workbook_name * | string |
find_hard_coded_inputs
ModelRisk: Heuristic discovery of cells that look like deterministic numeric inputs — i.e. a plain number, referenced by at least one formula. These are candidates for replacing with a distribution + VoseInput wrapper.
| Parameter | Type | Description |
|---|---|---|
workbook_name * | string |
list_vmrs_variables
ModelRisk: List every variable in the active simulation results (`.vmrs`) that's also declared as a VoseInput or VoseOutput in the workbook. Each entry: `{name, kind, var_id, iterations}`. Use this before `get_samples` or `read_vmrs` when you don't already know which outputs / inputs exist in the file.
| Parameter | Type | Description |
|---|---|---|
workbook_name | Workbook name. Omit for the active workbook. |
get_samples
ModelRisk: Return raw per-iteration sample values for a single output or input. Useful for custom histograms, arbitrary percentiles, downstream analysis. Caps at 10 000 samples by default to keep the MCP response small; raise `max_n` if you need more (a 100 000-iteration sim returns ~100 KB of JSON at max_n=100000).
| Parameter | Type | Description |
|---|---|---|
output_name * | string | VoseInput or VoseOutput name. |
max_n | integer | Maximum samples to return (default 10 000). |
workbook_name | Workbook name. Omit for the active workbook. |
set_active_vmrs
ModelRisk: Pin a specific `.vmrs` file as the source of simulation results. Pass the absolute path of the file; subsequent calls to get_simulation_results / get_correlation_matrix / get_sensitivity_ranking will read from it instead of trying to locate a sibling file next to the workbook. Pass an empty string to clear the override.
| Parameter | Type | Description |
|---|---|---|
path * | string | Absolute path to a .vmrs file, or '' to clear. |
read_vmrs
ModelRisk: Read simulation results directly from a `.vmrs` file. Convenience wrapper for `set_active_vmrs` + `get_simulation_results` that doesn't need an open workbook. Pass `output_names` to filter; leave empty to attempt enumeration of all known outputs.
| Parameter | Type | Description |
|---|---|---|
path * | string | Absolute path to a .vmrs file. |
output_names |
compute_distribution
ModelRisk: Analytic distribution calculator — compute a property of a distribution WITHOUT running a simulation. Give a `family` (e.g. 'Normal', 'Lognormal', 'PERT') and its `parameters`, OR point at an `object_cell` that already holds a Vose distribution object (e.g. a fitted distribution). `metric` is one of: 'pdf' (density f(x)), 'cdf' (P(X<=x)), 'exceedance' (P(X>x)), 'quantile' (the x at cumulative probability u), 'mean', 'stdev', 'variance', 'skewness', 'kurtosis', 'cov', or 'summary' (all moments + a percentile ladder in one call). `at` is x for pdf/cdf/exceedance and u (0-1) for quan…
| Parameter | Type | Description |
|---|---|---|
metric * | string | pdf | cdf | exceedance | quantile | mean | stdev | variance | skewness | kurtosis | cov | summary |
at | x (pdf/cdf/exceedance) or u in (0,1) for quantile. | |
family | Distribution family, e.g. 'Lognormal'. Omit if using object_cell. | |
object_cell | A1-style cell already holding a Vose distribution object. | |
object_sheet | Sheet of object_cell, if used. | |
parameters | Positional parameters for the family, in ModelRisk order. |
fit_and_rank_distributions
ModelRisk: Fit several distribution families to a data range and rank them by goodness of fit. For each family it fits Vose<Family>FitObject and scores it with ModelRisk's information criteria — AIC, SIC (Schwarz/BIC) and HQIC — then ranks ascending (lower = better) by `criterion`. Families with no fit function, or that can't fit the data, are returned under `skipped` with a reason. Use this instead of guessing a single family for fit_distribution_to_data. Runs on a transient scratch sheet that is always deleted; the data is not modified.
| Parameter | Type | Description |
|---|---|---|
data_range * | string | A1-style range of the data, e.g. 'A1:A200'. |
sheet * | string | Sheet holding the data. |
workbook * | string | Workbook file name, e.g. 'model.xlsx'. |
criterion | string | Ranking criterion: 'SIC' (default), 'AIC', or 'HQIC'. |
families | Families to try. Omit for a broad continuous default set. | |
uncertainty | boolean | Fit with parameter uncertainty (second-order). Default False. |
get_tail_risk
ModelRisk: Tail-risk profile of a simulation output from its per-iteration samples — Value-at-Risk (VaR) and Conditional VaR / expected shortfall (CVaR) at each confidence level, plus optional threshold probabilities P(X>t) / P(X<=t). `tail='upper'` (default) treats large values as the loss (e.g. cost, claims); `tail='lower'` treats small values as the loss (e.g. NPV, profit). VaR is the alpha-quantile; CVaR is the mean of the worst (1-alpha) tail beyond it. Reads the samples ModelRisk recorded in the .vmrs — run a simulation first.
| Parameter | Type | Description |
|---|---|---|
output_name * | string | VoseOutput (or VoseInput) name. |
alphas | Confidence levels for VaR/CVaR. Default [0.95, 0.99]. | |
max_n | integer | Max samples to read (default 100 000). |
tail | string | 'upper' (large = bad, default) or 'lower' (small = bad). |
thresholds | Values to compute P(X>t) / P(X<=t) for. Optional. | |
workbook_name | Workbook name. Omit for the active workbook. |
compute_correlation_matrix
ModelRisk: Compute the rank-order (Spearman) correlation matrix of a data range via VoseCorrMatrix, and its nearest valid (positive-semidefinite) form via VoseValidCorrmat. Use this to turn historical data into the correlation matrix you feed to create_copula for correlated inputs. Variables are columns by default (set `data_in_rows=True` if each row is a variable). Read-only: runs on a transient scratch sheet that is always deleted.
| Parameter | Type | Description |
|---|---|---|
data_range * | string | A1-style range of the data, e.g. 'A1:D200'. |
sheet * | string | Sheet holding the data. |
workbook * | string | Workbook file name. |
data_in_rows | boolean | True if each variable is a row. Default: columns. |
fit_tail
ModelRisk: Fit an extreme-value / Generalised-Pareto tail to data and read its risk. `family` is 'GPD' (peaks-over-threshold, the standard tail model), 'GEV' (block maxima), 'ExtValueMax', or 'ExtValueMin'. For GPD peaks-over-threshold, pass the range of exceedances above your threshold as `data_range`. Writes a Vose<Family>FitObject (dry_run previews) and returns the fitted tail's mean and high percentiles (P95 / P99 / P99.5 / P99.9) computed analytically — the tail risk without a simulation. Feed the written object cell to compute_distribution / get_tail_risk for more.
| Parameter | Type | Description |
|---|---|---|
data_range * | string | A1-style range of the tail data. |
sheet * | string | |
target_cell * | string | |
workbook * | string | |
dry_run | boolean | |
family | string | 'GPD' (default), 'GEV', 'ExtValueMax', or 'ExtValueMin'. |
uncertainty | boolean | Fit with parameter uncertainty. Default True. |
compare_distributions
ModelRisk: Compare two simulation outputs head-to-head from their per-iteration samples — mean/stdev/percentile differences, P(A > B), and first- and second-order stochastic dominance (under the convention that larger outcomes are preferred). First-order dominance means one option is better at every probability level; second-order adds risk-aversion. Use it to decide between strategies. Run a simulation that records both outputs first.
| Parameter | Type | Description |
|---|---|---|
output_a * | string | First output (VoseOutput) name. |
output_b * | string | Second output name. |
max_n | integer | Max samples per output (default 100 000). |
workbook_name | Workbook name. Omit for the active workbook. |
backtest_output
ModelRisk: Backtest a simulation output against realised actuals — does the model's predicted distribution match what actually happened? Reports the Probability Integral Transform (PIT, ~0.5 mean and uniform if calibrated), the empirical coverage of central prediction intervals (e.g. ~90% of actuals should fall in the 90% interval), and bias. Pass the historical `actuals` you want to validate against. Reads the output's per-iteration samples — run the simulation first.
| Parameter | Type | Description |
|---|---|---|
actuals * | array | Realised historical values. |
output_name * | string | VoseOutput name to validate. |
intervals | Central intervals to check coverage of. Default [0.5,0.8,0.9,0.95]. | |
max_n | integer | Max samples to read (default 100 000). |
workbook_name | Workbook name. Omit for the active workbook. |
decompose_uncertainty
ModelRisk: Split an output's uncertainty into EPISTEMIC (parameter / knowledge uncertainty — reducible with more data) and ALEATORY (natural variability — irreducible), via the law of total variance. ModelRisk has no two-dimensional-simulation worksheet function, so this approximates it from two runs you provide as two outputs: `total_output` from a full run (everything varying), and `conditional_output` from a run with the epistemic/parameter inputs FROZEN at point estimates (only natural variability left). Epistemic variance = total - aleatory. Tells you whether collecting more data (cut…
| Parameter | Type | Description |
|---|---|---|
conditional_output * | string | Output name from the run with epistemic inputs frozen. |
total_output * | string | Output name from the full run (all inputs varying). |
max_n | integer | Max samples to read (default 100 000). |
workbook_name | Workbook name. Omit for the active workbook. |
fit_copula_to_data
ModelRisk: Fit parametric copulas to a multi-column data range and rank them by goodness of fit — the DEPENDENCE STRUCTURE fitted from data, not merely constructed. Tries Normal, T, Clayton, Frank and Gumbel families (Vose<Family>FitObject), scores each with AIC / SIC / HQIC, and reports the winner plus its tail-dependence character (lower = crash-together, upper = boom-together, both = T, none = Normal/Frank) — the joint-tail risk a single correlation coefficient throws away. Runs on a transient scratch sheet that is always deleted; the data is not modified. Pair with fit_all_data_and_wir…
| Parameter | Type | Description |
|---|---|---|
data_range * | string | A1 range of the multi-column data, e.g. 'A1:C500'. |
sheet * | string | Sheet holding the data. |
workbook * | string | Workbook file name, e.g. 'model.xlsx'. |
criterion | string | Ranking criterion: 'SIC' (default), 'AIC', or 'HQIC'. |
data_in_rows | boolean | True if each variable is a ROW, not a column. Default False. |
families | Copula families to try. Omit for the default 5-family set. | |
uncertainty | boolean | Fit with parameter uncertainty (second-order). Default False. |
fit_time_series
ModelRisk: Fit TIME-SERIES models to a historical data range and rank them by goodness of fit — GBM (plus mean-reverting / jump-diffusion / seasonal variants), AR1/AR2, MA1/MA2, ARMA, ARCH/GARCH/EGARCH. Each family's VoseTime<Family>FitObject is scored with AIC / SIC / HQIC on a transient scratch sheet (nothing in the workbook is modified by the ranking). Optionally pass `target_range` (+ dry_run=False) to write the best model's projection — a VoseTime<Family>Fit(...) ARRAY formula, one period per cell, CSE-entered — so each simulated path carries the fitted dynamics (autocorrelation, vo…
| Parameter | Type | Description |
|---|---|---|
data_range * | string | A1 range of the history, oldest first, e.g. 'B5:B64'. May be sheet-qualified ('Data!B5:B64'). |
sheet * | string | Sheet holding the historical data. |
workbook * | string | Workbook file name. |
criterion | string | Ranking criterion: 'SIC' (default), 'AIC', or 'HQIC'. |
dry_run | boolean | Preview the projection formula without writing. Default True. |
families | Family stems to try, e.g. ['GBM','AR1','GARCH']. Omit for a broad 12-family default. | |
target_range | Range to CSE-enter the best model's projection into, e.g. 'D5:D16' for a 12-period forecast. Omit to rank only. | |
target_sheet | Sheet for target_range. Defaults to `sheet`. |
reverse_stress_test
ModelRisk: Reverse stress test — start from a BAD output outcome and work back to the joint input state that produces it. Partitions the simulation's iterations into breach / no-breach (output above/below a threshold, given directly or as a percentile), then for each input reports how far its mean shifts inside the breach set (in its own standard deviations) and how concentrated breaches are in its tail — a breach-driver tornado — plus the mean input vector as a concrete named stress scenario. This is the Solvency II / PRA 'reverse stress test' and is only possible with the engine's reco…
| Parameter | Type | Description |
|---|---|---|
output_name * | string | VoseOutput name to stress. |
direction | string | Breach side: 'above' (default) or 'below' the threshold. |
max_n | integer | Max samples per variable to pull. Default 100000. |
threshold | Breach threshold on the output. Omit to use threshold_percentile. | |
threshold_percentile | Breach threshold as an output percentile (0-1), e.g. 0.95. Used when `threshold` is omitted. | |
workbook_name | Workbook name. Omit for the active workbook. |
insert_distribution
ModelRisk: Write a Vose distribution formula (e.g. =VoseModPERT(...)) into a cell. Validates the function name against the ModelRisk catalogue. Defaults to dry_run=True — Claude must explicitly pass dry_run=False to commit.
| Parameter | Type | Description |
|---|---|---|
cell * | string | A1 cell reference like 'B12'. |
function_name * | string | |
parameters * | array | |
sheet * | string | |
workbook * | string | |
dry_run | boolean |
wrap_with_input
ModelRisk: Wrap an existing distribution cell with VoseInput("name")+ so it appears in the input list and the Results Viewer.
| Parameter | Type | Description |
|---|---|---|
cell * | string | |
name * | string | |
sheet * | string | |
workbook * | string | |
dry_run | boolean |
wrap_with_output
ModelRisk: Wrap an existing output cell with VoseOutput("name")+ so it appears in the output list and Results Viewer.
| Parameter | Type | Description |
|---|---|---|
cell * | string | |
name * | string | |
sheet * | string | |
workbook * | string | |
dry_run | boolean |
replace_constant_with_distribution
ModelRisk: Replace a hard-coded number in a cell with a Vose distribution wrapped by VoseInput. Use after find_hard_coded_inputs identifies candidates. This is the only tool that overwrites a non-Vose cell — it does so by design.
| Parameter | Type | Description |
|---|---|---|
cell * | string | |
function_name * | string | |
input_name * | string | |
parameters * | array | |
sheet * | string | |
workbook * | string | |
dry_run | boolean |
fit_distribution_to_data
ModelRisk: Fit a distribution family to a data range and write the result. 'family' is e.g. 'Normal', 'Lognormal', 'Beta', 'Gamma', 'Weibull' — the tool maps it to the catalogue function (Vose<Family>Fit). Set uncertainty=True (the default) to include parameter uncertainty in the fitted distribution.
| Parameter | Type | Description |
|---|---|---|
data_range * | string | |
family * | string | Distribution family, e.g. 'Normal'. |
sheet * | string | |
target_cell * | string | |
workbook * | string | |
as_object | boolean | Write Vose<Family>FitObject(...) instead of the sampling Vose<Family>Fit(...). The OBJECT form is what compute_distribution / VoseMean / VosePercentile need to answer analytic questions about the fit;… |
dry_run | boolean | |
uncertainty | boolean |
create_aggregate_mc
ModelRisk: Build a VoseAggregateMC(n, distribution, ...) formula that simulates the aggregate of a (possibly random) number n of i.i.d. severity draws. n and distribution are cell references — n points at a frequency cell, distribution at a severity object cell (built with a Vose<Family>Object function).
| Parameter | Type | Description |
|---|---|---|
frequency_object_cell * | string | |
severity_object_cell * | string | |
sheet * | string | |
target_cell * | string | |
workbook * | string | |
distribution_shift | ||
dry_run | boolean | |
max_limit | ||
min_limit |
create_aggregate
ModelRisk: Build a frequency-severity aggregate using the chosen `method` — 'FFT' (Fast Fourier Transform) or 'Panjer' (Panjer recursion) for the fast analytic methods, or 'MC' for Monte Carlo. frequency_object_cell and severity_object_cell are references to distribution-object cells (built with Vose<Family>Object). FFT and Panjer support `as_object=True`, which writes the ...Object form whose mean and percentiles can be read directly with compute_distribution / get_tail_risk — the aggregate loss distribution WITHOUT running a simulation. Method-specific options: `density` (FFT), `interval…
| Parameter | Type | Description |
|---|---|---|
frequency_object_cell * | string | |
severity_object_cell * | string | |
sheet * | string | |
target_cell * | string | |
workbook * | string | |
as_object | boolean | Write the analytic ...Object form (FFT/Panjer only) instead of a per-iteration sample. Lets you read the aggregate distribution without simulating. |
density | FFT only: density discretisation flag. | |
distribution_shift | MC only: severity shift. | |
dry_run | boolean | |
intervals | Panjer only: number of discretisation intervals. | |
max_limit | MC only: per-severity upper limit. | |
max_p | Panjer only: cumulative-probability cap. | |
method | string | Aggregation engine: 'FFT', 'Panjer', or 'MC'. |
min_limit | MC only: per-severity lower limit. |
create_risk_event
ModelRisk: Build a VoseRiskEvent(probability, impact_object) formula. The impact_function_name must be a distribution-object function (category 'object') — typically a Vose<Family>Object variant.
| Parameter | Type | Description |
|---|---|---|
impact_function_name * | string | |
impact_parameters * | array | |
probability * | ||
sheet * | string | |
target_cell * | string | |
workbook * | string | |
dry_run | boolean |
create_time_series
ModelRisk: Build a time-series formula (VoseTimeGBM, VoseTimeAR1, etc.) and write it into the target_range. Time-series tools are exempt from the >50-cell bulk-write guard because the dimension of the time series is the whole point.
| Parameter | Type | Description |
|---|---|---|
function_name * | string | |
parameters * | array | |
sheet * | string | |
target_range * | string | A1 range to spill into, e.g. 'D2:D101'. |
workbook * | string | |
dry_run | boolean |
create_copula
ModelRisk: Build a copula formula (e.g. VoseCopulaMultiNormal) that produces a correlated u-array for downstream distribution calls. Copula tools are exempt from the bulk-write guard.
| Parameter | Type | Description |
|---|---|---|
function_name * | string | |
parameters * | array | |
sheet * | string | |
u_array_target_range * | string | |
workbook * | string | |
dry_run | boolean |
set_named_range
ModelRisk: Create or overwrite a workbook-level named range. Useful for giving cells clear identities the LLM can reference by name later. The reference must be A1-style (e.g. 'Sheet1!$A$1:$A$10').
| Parameter | Type | Description |
|---|---|---|
name * | string | |
range_ref * | string | |
workbook * | string | |
dry_run | boolean |
write_formula
ModelRisk: Write an arbitrary formula or value into a single cell. Use this for wiring cells (e.g. =A1*B1, =SUM(...), =IF(...), or links to other sheets) that aren't covered by the Vose-specific tools. Safety: refuses to overwrite a cell containing an existing formula unless allow_overwrite=True — that protects user-written formulas AND prior Vose distributions. Empty cells write freely. Defaults to dry_run=True; pass dry_run=False to commit. Every commit appends to the audit log so `restore_cell` can roll back.
| Parameter | Type | Description |
|---|---|---|
cell * | string | A1 cell reference like 'C1'. |
formula * | string | Formula or value to write. Excel-style; leading '=' is optional (we'll add it if missing for non-numeric content). |
sheet * | string | |
workbook * | string | |
allow_overwrite | boolean | Permit overwriting a non-empty cell. Required if the cell already has any content. Without this flag the tool refuses and returns the existing formula so Claude can decide what to do. |
dry_run | boolean |
save_workbook_as
ModelRisk: Save the workbook to a specific path on disk. Distinct from the user's Ctrl+S — the MCP server never calls Workbook.Save() implicitly. Use only when the caller explicitly named a target file. Refuses to overwrite an existing file unless overwrite=True. Returns the resolved absolute path that was written.
| Parameter | Type | Description |
|---|---|---|
path * | string | Absolute path. Must end in .xlsx, .xlsm, .xlsb, or .xls. |
workbook * | string | |
overwrite | boolean |
restore_cell
ModelRisk: Restore a cell to its pre-write state from the audit log. Reads %LOCALAPPDATA%\VoseSoftware\modelrisk-mcp\writes.log and rewrites the oldest captured before-formula for the cell. Pass `since` (ISO timestamp) to restrict the window.
| Parameter | Type | Description |
|---|---|---|
cell * | string | |
sheet * | string | |
workbook * | string | |
since | Optional ISO-8601 timestamp. Restore the oldest write captured at or after this time. |
restore_deterministic_state
ModelRisk: Recover a workbook that's been left in a 'frozen sample' state — VoseOutput cells stuck on per-iteration sample values instead of their deterministic baseline. Triggers a full Excel recalculation (Application.CalculateFull) which re-evaluates every formula and restores the deterministic values. Use this after `run_simulation` raises a post-condition error, or whenever `list_modelrisk_outputs` shows nonsense `current_value`s that look like a single sample draw rather than the model's deterministic answer.
| Parameter | Type | Description |
|---|---|---|
workbook_name | Workbook to recalculate. Omit for the active workbook. |
run_simulation
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. ModelRisk simulates the active workbook, so a named workbook is made active first. The saved .vmrs is checked to hold this run (workbook, s…
| Parameter | Type | Description |
|---|---|---|
engine | string | 'classic' (default): ModelRisk's own engine, in Excel. 'turbo': ModelRisk's Turbo engine; .xlsx and .xlsm workbooks only, and falls back to classic when it cannot run the workbook. |
iterations | Alias for `samples`. ModelRisk's UI calls this 'samples'; many users call it 'iterations'. Both work. | |
samples | Iteration count. Default: 1000. Either `samples` or `iterations` is accepted (they mean the same thing). If both are passed, `samples` wins. | |
save_to | 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 folde… | |
seed | integer | Random seed for reproducibility (fixed seed). |
workbook_name | Workbook file name (e.g. 'model.xlsx'). Omit for the active workbook. |
run_scenarios
ModelRisk: Sweep a single input cell across multiple deterministic values, running a full simulation at each. Returns per-output P5 / P50 / P95 / mean for every scenario value. Useful for what-if analysis: 'what if widget cost is $50 vs $75 vs $100'. The cell's original formula is captured before the sweep and restored afterwards (even on error), so the workbook ends in its pre-call state. Each scenario takes roughly the same time as one `run_simulation` call, so keep the values list short — 3-7 scenarios is a normal range.
| Parameter | Type | Description |
|---|---|---|
cell * | string | A1-style cell reference for the input to sweep. |
sheet * | string | Sheet name holding the input cell. |
values * | array | Deterministic values to test (1-20 scenarios). |
samples | integer | Iterations per scenario. |
seed | integer | Fixed seed (same seed across scenarios). |
workbook_name | Workbook name. Omit for the active workbook. |
propose_distributions_for_inputs
ModelRisk: Propose distribution families for a list of uncertain inputs. Each input gets a ranked list of recommendations from the methodology-grounded selection guide. The tool does NOT write to Excel — it returns suggestions for the LLM to walk through with the user before committing via replace_constant_with_distribution.
| Parameter | Type | Description |
|---|---|---|
inputs * | array | Each entry: {cell_ref?, current_value?, description}. `description` is the natural-language description of the uncertain quantity (e.g. 'unit cost of widget X'). |
discover_inputs
ModelRisk: Discover candidate input cells — numeric cells referenced by formulas — and rank them by how likely they are to be uncertain model inputs (vs. constants like 12 months per year). The ranking weighs reference count and number magnitude. Pair with propose_distributions_for_inputs.
| Parameter | Type | Description |
|---|---|---|
workbook_name * | string | |
limit | integer |
plan_risk_model
ModelRisk: One-call blueprint for turning a deterministic workbook into a Monte Carlo risk model. Reports what's already there (declared outputs, existing distributions), the ranked hard-coded cells that look like uncertain inputs, and an ordered, state-aware checklist of next actions (wrap outputs, fit/propose distributions, correlate, audit, simulate, interpret). Read-only — it plans, it doesn't modify. Run this first when asked to 'add uncertainty' or 'make this a risk model'.
| Parameter | Type | Description |
|---|---|---|
workbook_name * | string |
audit_model
ModelRisk: Run the model audit against the workbook. Each rule's detector lives in modelrisk_mcp.audit.rules; the rule set is editable in data/audit_rules.yaml. Returns an AuditReport with severity-tagged findings (error/warning/info) and suggested fixes.
| Parameter | Type | Description |
|---|---|---|
workbook_name * | string |
diagnose_workbook
ModelRisk: One-call workbook health check. Returns everything an MCP client typically wants at the start of a session: whether Excel is reachable, whether the ModelRisk SDK is activated, the active workbook's name + sheets, counts of inputs / outputs / distributions, whether a sibling `.vmrs` exists and when it was last modified, and the audit-log location. Use this as the first call instead of orchestrating 4-5 individual reading tools.
| Parameter | Type | Description |
|---|---|---|
workbook_name | Workbook name. Omit for the active workbook. |
build_drivers_report
ModelRisk: Build a single-sheet drivers report — a sensitivity analysis presented for a decision-maker. Drops onto a new sheet: title band; auto-generated KEY FINDINGS in plain English ('The dominant driver of NPV is widget cost, r = -0.65; higher widget cost lowers NPV'); a prominent tornado chart; a driver-ranking table with correlation + |r| + approximate variance share; a HOW TO READ THIS CHART panel for stakeholders who don't know what Spearman correlation means; and tiered RECOMMENDED ACTIONS (focus / monitor / deprioritise) grouping inputs by strength. Use this when the user asks for…
| Parameter | Type | Description |
|---|---|---|
output_name * | string | The output to analyze drivers for (e.g. 'NPV', 'TotalCost'). Each call produces one sheet for one output. Call multiple times for multiple outputs. |
sheet_name | string | Target sheet name. Default 'Drivers_Report'. Replaced if it already exists. |
subtitle | Subtitle. Default: 'Sensitivity analysis · N iterations · <date>'. | |
title | Report title. Default: 'Uncertainty Drivers — <output>'. | |
workbook_name | Workbook name. Omit for the active workbook. |
build_executive_report
ModelRisk: Build a single-sheet executive report for a decision-maker. Drops a curated dashboard onto a new sheet with: title band, headline numbers (mean / P5 / P50 / P95 / stdev — colored by volatility), histogram + cumulative chart of the primary output, tornado of top N sensitivity drivers, a stats table for the primary plus any secondary outputs, and auto-generated risk callouts framed in plain English ('90% confident X lands between A and B', 'tail risk Y% above mean', 'primary driver is Z'). Idempotent — re-running replaces the sheet. Use this when the user asks for a decision-maker…
| Parameter | Type | Description |
|---|---|---|
primary_output * | string | The single output the report focuses on (e.g. 'NPV', 'TotalCost'). Headline numbers and the histogram + tornado are about this output. |
contingency_percentile | number | The 'high-side' percentile to highlight in the headline. Default 0.90 (P90). |
secondary_outputs | Additional outputs to include in the stats table. The primary output is always first; these appear below. | |
sheet_name | string | Target sheet name. Default 'Executive_Report'. Replaced if it already exists. |
subtitle | Subtitle shown beneath the title. Default: '<N> iterations · <today's date>'. | |
title | Report title shown in the top band. Default: 'Simulation Report — <primary_output>'. | |
top_drivers | integer | How many inputs to show in the tornado mini-chart. |
workbook_name | Workbook name. Omit for the active workbook. |
create_tornado_chart
ModelRisk: Render a tornado chart of input sensitivity for a single output as a new sheet in the workbook. The sheet has a sorted data table (Spearman rank correlation + regression coefficient per input) plus a native Excel BarClustered chart with the largest-magnitude input at the top. Idempotent — if a sheet with the target name already exists, it's replaced. Useful when the user wants the visualization persisted in the workbook, not just returned over MCP.
| Parameter | Type | Description |
|---|---|---|
output_name * | string | VoseOutput name to analyze. |
sheet_name | Target sheet name. Default: `Tornado_<output_name>` (truncated to Excel's 31-char limit). | |
workbook_name | Workbook name. Omit for the active workbook. |
create_histogram_chart
ModelRisk: Render a histogram of one output's simulation result distribution as a new sheet in the workbook. The sheet has a binned data table (bin centre / frequency / cumulative %) plus a native Excel chart: frequency columns with the cumulative-probability curve overlaid on a secondary % axis and the central-80% (P10-P90) band highlighted — the same view as ModelRisk's Results Viewer, persisted into the workbook. Requires a completed simulation (reads samples from the active .vmrs). Idempotent — a sheet with the target name is replaced.
| Parameter | Type | Description |
|---|---|---|
output_name * | string | VoseOutput name to chart. |
sheet_name | Target sheet name. Default: `Histogram_<output_name>` (truncated to Excel's 31-char limit). | |
workbook_name | Workbook name. Omit for the active workbook. |
create_cdf_chart
ModelRisk: Render the ascending cumulative-probability curve (CDF) of one output's simulation result distribution as a new sheet in the workbook. The sheet has a binned data table plus a native Excel line chart of cumulative probability (0-100%) against the output value — the 'what's the chance the output is below X' view. Requires a completed simulation (reads samples from the active .vmrs). Idempotent — a sheet with the target name is replaced.
| Parameter | Type | Description |
|---|---|---|
output_name * | string | VoseOutput name to chart. |
sheet_name | Target sheet name. Default: `CDF_<output_name>` (truncated to Excel's 31-char limit). | |
workbook_name | Workbook name. Omit for the active workbook. |
generate_executive_summary
ModelRisk: Generate an executive-audience summary of the most recent simulation results for a workbook. Returns markdown ready to paste into a deck/report — covers deterministic vs P50 vs mean comparisons, P80 contingency, and the top sensitivity drivers.
| Parameter | Type | Description |
|---|---|---|
workbook_name * | string | |
deterministic_values | Optional map of output name → its deterministic (unsimulated) value, so the summary can quote the uplift/contingency. If omitted, the summary skips that comparison. |
fit_all_data_and_wire
ModelRisk: Fit BOTH the marginal distributions and the copula dependence from a data block, then wire the whole correlated, simulation-ready model into the workbook in one reversible pass. For each variable column it fits+ranks the best marginal (AIC/SIC/HQIC); across the columns it fits the best copula (fit_copula_to_data) and writes the correlated-U block at `copula_anchor`; each marginal is wired to its copula U so the inputs are dependent, not independent — capturing the tail co-movement a single correlation coefficient discards. Optionally runs a validating simulation. Defaults to dry_r…
| Parameter | Type | Description |
|---|---|---|
columns * | array | One entry per data column, in column order: {'input_name': 'Demand', 'target_cell': 'F2'}. |
data_range * | string | Rectangular data block, one column per variable, e.g. 'A2:C500'. |
sheet * | string | Sheet holding the data and target cells. |
workbook * | string | Workbook file name. |
copula_anchor | Top cell for the correlated-U block. Omit to skip correlation. | |
criterion | string | Fit criterion: 'SIC' (default), 'AIC', or 'HQIC'. |
dry_run | boolean | Preview the planned formulas without writing. Default True. |
run | boolean | Run a validating simulation after wiring. Default False. |
samples | integer | |
seed | integer | |
target_sheet | Sheet holding the target cells and the copula block. Defaults to `sheet` (the data sheet) — pass this when the model lives on a different sheet than the data, e.g. data on 'Data', wired inputs on 'M… | |
uncertainty | boolean | Fit with parameter uncertainty. Default False. |
build_model_from_brief
ModelRisk: Turn a deterministic workbook into a simulation-ready Monte Carlo model in one atomic, reversible pass. Given the output cells to track and the uncertain inputs to add (each with a Vose distribution family + parameters you choose from the brief), it wraps the outputs with VoseOutput, replaces the input cells with VoseInput-wrapped distributions, optionally runs a validating simulation, and returns the headline percentiles. Every write goes through the audit-logged safe-write path and is tracked in a change-set: if any step fails, the ENTIRE build is rolled back so the workbook is ne…
| Parameter | Type | Description |
|---|---|---|
inputs * | array | Uncertain inputs to create, each: {'cell': 'B4', 'input_name': 'Demand', 'function_name': 'VoseModPERT', 'parameters': [{'value': 100}, {'value': 150}, {'value': 250}]}. |
sheet * | string | Sheet holding the cells. |
workbook * | string | Workbook file name. |
dry_run | boolean | Preview the planned build without writing. Default True. |
outputs | Output cells to wrap: [{'cell': 'B12', 'output_name': 'NPV'}]. Omit if outputs are already wrapped. | |
run | boolean | Run a validating simulation after building. Default True. |
samples | integer | |
seed | integer |