Skip to main content
Glama

TradingCalc MCP: Options, Forex, Risk Stats, Prediction Markets, On-Chain & Crypto Futures

Risk Parity Weights

workflow.run_risk_parity
Read-only

Risk-parity (equal or custom risk contribution) portfolio weights for N assets: given a covariance matrix (or N return series to compute one from), finds long-only weights where each asset contributes its target share of total portfolio risk. Edge cases: give either returns (at least 2 assets, each series at least 2 values and all the same length) or a square covariance matrix (2 by 2 or larger), never neither; risk_budgets must be positive, finite, one per asset (they are normalized, so they need not sum to 1); an asset with zero or negative variance is an error; non-finite values are an error. Long-only weights. Not covered: shorting, leverage, weight bounds, transaction costs, and estimation error of the covariance (garbage in, garbage out). Use when user asks "what weights give each asset equal risk contribution?" or "how do I risk-parity-weight this portfolio?". A portfolio-construction calculation, not a buy/sell recommendation. Returns: weights, risk_contributions (should match risk_budgets exactly at convergence), portfolio_volatility.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "workflow.run_risk_parity"
  }
}

Input Schema

NameRequiredDescriptionDefault
returnsNoOne return series per asset (2+ assets, all series the same length). Provide this OR covariance, not both.
covarianceNoDirect NxN covariance matrix, if not supplying returns[][] directly.
risk_budgetsNoTarget risk share per asset, one per asset (need not sum to 1, normalized internally). Default: equal (1/N each).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.6/5.0
Behavior5/5

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

Annotations declare a safe read-only, closed-world operation, and the description adds substantial context beyond them: the solution is long-only, budgets are normalized internally rather than required to sum to 1, zero/negative variance and non-finite inputs are hard errors, and risk contributions should match budgets at convergence. The explicit "not covered" list preempts false expectations about leverage and weight bounds.

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 with the core computation before edge cases, and the error conditions are compressed into a single dense but readable sentence. Minor waste: "Long-only weights" appears twice (once in the opening clause, once as a standalone fragment), and the returns sentence partly duplicates the parameter docs.

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?

Despite no output schema, the description enumerates the return values (weights, risk_contributions matching budgets at convergence, portfolio_volatility), and all three inputs are covered with minimum-size and validity rules. Nothing an agent needs to call this correctly — input form choice, error conditions, output shape — is missing.

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

Parameters4/5

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

Schema coverage is 100%, so baseline would be 3, but the description adds real meaning: at least 2 assets, each series at least 2 values of identical length, covariance must be square and 2x2 or larger, and the two inputs are mutually exclusive ("never neither"). Risk budgets must be positive and finite and are normalized. It adds the either/or exclusivity and minimum-size constraints that the bare schema does not enforce.

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?

States a specific verb and resource — computing risk-parity portfolio weights from a covariance matrix or return series, with equal or custom risk contributions. It is clearly distinguishable from nearby siblings such as workflow.run_portfolio_risk or workflow.run_kelly_frontier because it names the exact optimization target (equal risk contribution) and the long-only constraint.

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?

Gives explicit when-to-use phrasing with example user questions ("what weights give each asset equal risk contribution?") and an explicit scope exclusion set (shorting, leverage, weight bounds, transaction costs, covariance estimation error), plus a note that this is a calculation, not a recommendation. It never names a sibling tool as the alternative path, so routing between overlapping portfolio tools 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.