Skip to main content
Glama

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

Max Leverage

workflow.run_max_leverage
Read-only

Calculate the maximum leverage that keeps a position within a drawdown limit, from account size, max acceptable drawdown, and asset daily volatility. Edge cases: accountSize and volatilityPct above zero; maxDrawdownPct above 0 and at most 100; mmr 0 to 0.1 (default 0.005). A planning figure from the numbers you give, not a limit set by an exchange. Not covered: gaps and fat-tail moves beyond the volatility you state, exchange maximum leverage and tiers, funding, and fees. Use when user asks "what leverage does a 10% drawdown limit allow on BTC?" or "what leverage fits a 3% daily volatility and a 10% drawdown limit?". Returns: maxLeverage (maxDrawdownPct / (volatilityPct + mmr x 100), rounded down to 0.1, never below 1x), marginAtRisk (accountSize x maxDrawdownPct / 100, in USDT), safeMargin (USDT) and liquidationBuffer (percent). maxDrawdownPct and volatilityPct are percents (10 means 10%); mmr is a fraction (0.005 is 0.5%).

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "accountSize": "<accountSize>",
      "maxDrawdownPct": "<maxDrawdownPct>",
      "volatilityPct": "<volatilityPct>"
    },
    "name": "workflow.run_max_leverage"
  }
}

Input Schema

NameRequiredDescriptionDefault
mmrNoMaintenance margin rate, default 0.005 (0.5%)
accountSizeYesTotal account size in USDT
volatilityPctYesExpected daily price volatility as percentage, e.g. 3 for 3%
maxDrawdownPctYesMaximum acceptable drawdown as percentage, e.g. 10 for 10%

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false and openWorldHint=false, and the description is consistent with a pure calculation. Beyond that it adds input validity ranges (accountSize/volatilityPct above zero, maxDrawdownPct 0-100, mmr 0-0.1) and deterministic rounding behavior (rounded down to 0.1, never below 1x), which is useful. It does not, however, discuss failure behavior when validation fails or precision/rounding of the USDT outputs beyond a brief note.

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?

It is front-loaded with purpose, then edge cases, then exclusions, then outputs and units, which is a sensible ordering. The formula and per-output breakdown are dense but justified because no output schema exists; the closing unit restatement is slightly redundant with the earlier validation sentence.

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?

With no output schema, the description fully carries the return contract: maxLeverage, marginAtRisk, safeMargin and liquidationBuffer, each with formula and units. Combined with validation ranges, usage examples, and explicit non-coverage, an agent has everything needed to call it and interpret results correctly.

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 the baseline is 3, but the description earns above baseline by adding unit disambiguation ('maxDrawdownPct and volatilityPct are percents (10 means 10%); mmr is a fraction (0.005 is 0.5%)') and validation bounds the schema omits. It also ties each parameter to the formula, showing what role it plays in the result.

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?

The description opens with a precise verb+resource+scope: 'Calculate the maximum leverage that keeps a position within a drawdown limit' from three named inputs. It also draws a conceptual boundary against sibling risk tools by stating it is 'a planning figure from the numbers you give, not a limit set by an exchange,' separating it from exchange/liquidation-driven tools like run_liquidation_live or run_liquidation_safety.

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?

It gives concrete trigger phrasings ('what leverage does a 10% drawdown limit allow on BTC?', 'what leverage fits a 3% daily volatility and a 10% drawdown limit?') that map user intent directly to this tool. It also states explicit exclusions ('Not covered: gaps and fat-tail moves beyond the volatility you state, exchange maximum leverage and tiers, funding, and fees'), which routes away from it when those factors matter.

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.