Skip to main content
Glama

Fair Value MCP Server

Expected value and probability weighting

calculate_expected_value
Read-onlyIdempotent

Expected-value engine. Compute expected values over discrete, continuous, simulated, or tree-structured uncertainty, plus football-field ranges. Use this for generic probability weighting of scenarios, Monte-Carlo and decision trees; it does NOT perform IFRS/HKFRS measurement of provisions, insurance or employee-benefit obligations (use calculate_actuarial_pv), and it does not price path-dependent payoffs (use calculate_structured_product). Methods: discrete: outcomes, probabilities; continuous: distribution, mean, std, lower, upper; scenario: scenarios; monte_carlo: iterations, distributions, base_params, seed; decision_tree: tree; football_field: estimates. Supply exactly one method with its declared inputs (no defaults). An unknown method, a missing input, or an extra field returns an error envelope (code INVALID_ARGUMENT) instead of raising.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stdNoDistribution standard deviation (>0).
meanNoDistribution mean.
seedNoDeterministic RNG seed (required by simulation methods for reproducibility).
treeNoDecision tree with chance/decision nodes.
lowerNoLower integration bound.
upperNoUpper integration bound.
methodYesFormula to apply; the tool description lists the exact inputs each value requires.
outcomesNoOutcome values aligned with probabilities.
estimatesNoEstimates [{method, central, low, high}] for a football field.
scenariosNoScenarios [{probability, value}] with probabilities summing to 1.
iterationsNoMonte-Carlo iterations (>=1000).
base_paramsNoBase parameter values for simulation.
distributionNoContinuous distribution to integrate over.
distributionsNoInput distributions [{parameter, type, mean, std}].
probabilitiesNoCumulative success probability per period in [0,1], aligned with cash_flows.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
errorNoError detail, present only when status='error'.
stepsNoOrdered computation steps, when the method reports them.
valueNoPrimary result: a number for scalar methods, an object for valuation methods.
methodNoMethod or tool name that produced the result.
statusYes'ok' on success, 'error' on failure.
tickerNoTicker the result pertains to, when applicable.
assumptionsNoInputs and assumptions used, echoed for traceability.
formula_refNoFormula or standards reference for the method.
data_timestampNoISO-8601 UTC timestamp of the underlying data, when fetched.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.7/5.0
Behavior4/5

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

Annotations already establish read-only, idempotent, non-destructive, closed-world behavior, and the description goes further by disclosing the validation contract: exactly one method, no defaults, and an INVALID_ARGUMENT error envelope rather than an exception. That failure-mode disclosure is real value beyond the annotations. One caveat: 'no defaults' is in mild tension with the schema, which lists default null for every optional field, so a 4 rather than a 5.

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-loads purpose, then exclusions, then the per-method input contract, then the error contract — a sensible priority order with no filler sentences. The middle method-inventory sentence is dense and list-heavy, but every element is load-bearing rather than decorative.

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

Completeness5/5

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

For a 15-parameter tool with an enum discriminator and an output schema, the description supplies the method-to-input contract, the mutual-exclusion rule, the sibling routing, and the error behavior. Return values are covered by the output schema, so nothing an agent needs to invoke this correctly is missing.

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

Parameters5/5

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

Schema coverage is 100% so the baseline would be 3, but the description adds the crucial conditional mapping the flat schema cannot express: which inputs each method value requires (discrete: outcomes+probabilities; continuous: distribution/mean/std/lower/upper; monte_carlo: iterations/distributions/base_params/seed, etc.). This resolves the cross-parameter dependency the enum alone leaves ambiguous.

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?

It names a specific verb and resource ('expected-value engine', 'Compute expected values') and immediately scopes the breadth of methods it covers. It distinguishes itself from sibling tools by name, explicitly ruling out calculate_actuarial_pv and calculate_structured_product, so an agent can route between them without opening any schema.

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

Usage Guidelines5/5

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

Explicit when-to-use ('generic probability weighting of scenarios, Monte-Carlo and decision trees') and two explicit when-not cases with the correct alternative tool named for each. Nothing about selection is left to inference.

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.