Skip to main content
Glama

Run a Monte Carlo simulation

run_simulation

Runs a Monte Carlo simulation over a graph of probabilistic root and calculated nodes, returning the full output distribution instead of one guessed number. Use this when you need the range and likelihood of outcomes for a plan driven by uncertain inputs, not just its average case. Both tiers run to completion and return the full result in this same call, never a run_id to poll. Example: {"graph":{"root_nodes":[{"id":"root","distribution_type":"normal","distribution_params":{"mean":100,"std":15}}],"calc_nodes":[{"id":"out","formula":"{e1}"}],"edges":[{"id":"e1","source":"root","target":"out"}],"run_params":{"trials":1000,"time_periods":12}}}

Input Schema

NameRequiredDescriptionDefault
seedNoOptional RNG seed; reproducible only on the small/inline path.
graphYesThe full simulation graph (root_nodes, calc_nodes, edges, run_params). See GET /api/v1/contract for valid distribution types.
api_keyNoYour API key from POST /api/v1/accounts. Debits credits per run. Omit to run anonymously (free, but no credit accounting).
include_histogramNoInclude a per-element histogram in each summary element.

Output Schema

NameRequiredDescriptionDefault
tierYes'small' or 'large'.
resultYesThe summarised result with aggregations.
run_idYes
statusYesAlways 'completed' on a 2xx response. A run that fails propagates as an error response (non-2xx + error envelope), not a 'failed' result.
total_trialsYes
credits_debitedNoCredits charged to the account (0 for anonymous).

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?

Adds genuine information beyond the annotations: it will not return a run_id to poll and completes synchronously in the same call, and it returns a full distribution rather than a summary point. What's left unexplained is the "both tiers" reference — the two execution paths (inline vs. large) are never defined, and no cost/credit or size-limit behavior is mentioned in the description.

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: purpose, then usage condition, then the synchronous-result guarantee, then an example. Every sentence earns its place. The single large JSON example is justified for a deeply nested input, though the unexplained "both tiers" phrase is filler that could be cut or clarified.

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?

With an output schema present, return values need no explanation, and the input schema fully documents the graph. The description covers purpose, selection criteria, and execution semantics. Gaps are minor: the tiers are undefined and credit consumption is only visible in the api_key schema field, not the description.

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 description coverage is 100% and the nested graph types are documented in depth, so the baseline is 3. The worked example does add concrete shape (root distribution params, formula edge ids, run_params), but it reillustrates rather than explaining anything the schema doesn't already state.

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?

Names a specific verb and resource ("Runs a Monte Carlo simulation") and immediately states what it is over ("a graph of probabilistic root and calculated nodes"). The contrast with "one guessed number" implicitly separates it from the point-estimate sibling, so an agent can tell what it produces without opening the 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?

Explicitly says when to use it: "when you need the range and likelihood of outcomes for a plan driven by uncertain inputs, not just its average case." That condition does the routing work against estimate/solve_distribution_parameters. It stops short of naming those alternatives or stating when not to use it (e.g. validating a graph first).

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.

Resources