Skip to main content
Glama

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

Portfolio Risk

workflow.run_portfolio_risk
Read-only

Aggregates risk across multiple open positions in one call: total notional, total P&L, total margin in use, margin usage as a % of account balance (if given), and which single position sits closest to liquidation. Each position is computed through the same canonical PnL/liquidation math as the single-position tools, then rolled up. Linear (USDT-margined) positions sum into one USD total; inverse (coin-margined) positions are grouped by settlement coin instead, since a BTC-margined P&L cannot be summed with an ETH-margined one without a live conversion rate. Returns a verdict: healthy / watch / reduce / critical, driven by the closest liquidation distance and margin usage. Use when user asks "how exposed am I across all my positions?" or "which of my positions is closest to liquidation?". Position size follows the product-wide convention: base-asset quantity for linear, USD notional (contracts) for inverse.

Input Schema

NameRequiredDescriptionDefault
positionsYesOpen positions to aggregate (1 to 50). Each: { side, entry_price, mark_price, size, leverage }, plus optional fees, mmr, contractType, coin, label.
account_balanceNoOptional account balance in USD, used to compute margin_usage_pct: linear margin plus every inverse position's own margin marked to market at its mark_price, all as one USD total

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / properties / positions / description
      Added value: +"Open positions to aggregate (1 to 50). Each: { side, entry_price, mark_price, size, leverage }, plus optional fees, mmr, contractType, coin, label."
    • addedInput schema / properties / positions / items / properties / side / description
      Added value: +"Trade direction: \"long\" or \"short\""
  2. Added

TDQS

A4.4/5.0
Behavior5/5

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

With readOnlyHint, openWorldHint=false, and destructiveHint=false already declaring the safety profile, the description adds rich behavioral context: the computation pipeline, why linear sums into USD while inverse groups by settlement coin, the need for a live conversion rate, and the healthy/watch/reduce/critical verdict logic. No auth or rate-limit constraints are needed for this compute tool.

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 aggregation and output list, then explains mechanics, verdict, use cases, and size convention. Dense but every sentence supports correct invocation or interpretation; minor redundancy with the schema on position-size wording.

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?

No output schema exists, so the description must explain return values; it does by listing total notional, total P&L, total margin, margin usage %, the position closest to liquidation, and verdict categories. It also covers input conventions and aggregation logic, making it complete for this complex tool.

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%, so the baseline is 3. The description adds the product-wide position-size convention and explains account_balance's effect on margin usage, but this information is already present in the schema descriptions and adds no new syntax or constraints beyond the structured fields.

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: aggregates risk across multiple open positions. Lists the exact outputs and explicitly contrasts with single-position tools by noting roll-up and canonical math. An agent can distinguish it from siblings like run_open_analysis or run_liquidation_safety 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?

Provides explicit trigger questions: 'how exposed am I across all my positions?' and 'which of my positions is closest to liquidation?'. Clear context for use, but no when-not-to-use guidance or named alternatives, so it stops short of a 5.

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.