Skip to main content
Glama

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

Position Sizing

workflow.run_position_sizing
Read-only

Calculate the correct position size given a maximum risk in USDT and a stop-loss price. Edge cases: entryPrice, stopLoss and riskUsdt above zero; leverage above zero (default 1); fees 0 to 0.05; a fee and price combination that makes the risk denominator zero or negative is an error. Not covered: slippage past the stop, funding, exchange lot size and step rounding, and whether the margin is available. Use when user asks "how many coins should I buy?" or "size my position so I risk exactly $X". Returns: positionSize (base), positionUsdt, marginRequired.

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": {
      "side": "<side>",
      "entryPrice": "<entryPrice>",
      "stopLoss": "<stopLoss>",
      "riskUsdt": "<riskUsdt>"
    },
    "name": "workflow.run_position_sizing"
  }
}

Input Schema

NameRequiredDescriptionDefault
sideYesTrade direction: "long" or "short"
leverageNoLeverage, default 1
riskUsdtYesMaximum acceptable loss in USDT
stopLossYesStop-loss price
entryPriceYesEntry price
feeOpenPctNoOpening fee fraction, default 0.0002
feeClosePctNoClosing fee fraction, default 0.0005
contractTypeNolinear = USDT-margined (default), inverse = coin-margined. For inverse, sizeQuote is USD contracts and margin is returned in the base coin.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / side / description
      Added value: +"Trade direction: \"long\" or \"short\""
  2. Changed1 schema field changed
    • addedInput schema / properties / contractType
      Added value: +{
      +  "description": "linear = USDT-margined (default), inverse = coin-margined. For inverse, sizeQuote is USD contracts and margin is returned in the base coin.",
      +  "enum": [
      +    "linear",
      +    "inverse"
      +  ],
      +  "type": "string"
      +}
  3. Added

TDQS

A4.4/5.0
Behavior5/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 fully consistent with a pure calculation. Beyond that it discloses validation bounds (entryPrice, stopLoss, riskUsdt above zero; leverage above zero default 1; fees 0 to 0.05) and a specific error condition where a fee/price combination makes the risk denominator zero or negative, which the annotations cannot convey.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose is front-loaded, then structured into 'Edge cases', 'Not covered' and 'Returns' blocks, each of which carries decision-relevant information. There is no filler and no restatement of the tool name.

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?

There is no output schema, but the description names the returned fields (positionSize, positionUsdt, marginRequired), and it covers preconditions, error behavior, and known limitations. For a single-calculation tool with full schema coverage, nothing an agent needs to invoke it correctly 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 description coverage is 100%, so the schema already documents all 8 parameters and the baseline would be 3. The description adds value beyond it by stating the fee fraction operating range (0 to 0.05), the leverage default, and the denominator-zero failure mode that governs how riskUsdt, entryPrice, stopLoss and the fee parameters interact.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb and resource: 'Calculate the correct position size given a maximum risk in USDT and a stop-loss price', and it names the exact computed outputs. It does not, however, differentiate itself from siblings such as run_max_leverage, run_forex_position_size_live, or run_pre_trade_check, which an agent may reasonably confuse with sizing/risk tools.

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?

It gives concrete trigger phrasing ('how many coins should I buy?', 'size my position so I risk exactly $X') plus an explicit 'Not covered' list for slippage, funding, lot size/step rounding, and margin availability, which effectively tells the agent when this tool is insufficient. It stops short of naming an alternative tool to route to for those uncovered cases.

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.