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

TableJSON Schema
NameRequiredDescriptionDefault
positionsYes
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. Added

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already establish readOnly/no-destructive/no-open-world, so the bar is lower, and the description adds real behavioral context: linear positions sum into one USD total while inverse positions are grouped by settlement coin because cross-coin P&L cannot be summed, plus the healthy/watch/reduce/critical verdict logic. It omits error/limit behavior (the 50-position cap lives only in the schema) and any latency or computation caveats.

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 aggregation outputs before explaining the linear/inverse math distinction, and every sentence carries information. It is long, but the length is justified by the tool's complexity and the need to explain the settlement-coin grouping rationale. No filler or repetition of the title.

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 no output schema, the description does the right thing by naming the returned fields and the verdict categories. It covers the core call path adequately for a 2-parameter tool; the remaining gaps are the inverse-position coin requirement and default behaviors, which are documented in the schema rather than 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 coverage is 50%, so the description must carry weight; it restates the product-wide size convention (already in the size field description) and the account_balance→margin_usage_pct relationship (also already in the schema), adding only marginal clarification. It does not explain the required vs optional mix of the item objects, so the schema largely does the heavy lifting here.

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 in one call') and enumerates exactly what is produced: total notional, total P&L, total margin, margin usage %, and closest-to-liquidation position. It also differentiates from the single-position tools by explaining the roll-up relationship, so an agent can place it among 70+ siblings.

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 phrasings ('how exposed am I across all my positions?', 'which of my positions is closest to liquidation?') that map directly to user intent. It does not state when NOT to use it or name a concrete alternative (e.g. run_liquidation_safety for a single position), so it falls just 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.