Skip to main content
Glama

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

PnL Planning

workflow.run_pnl_planning
Read-only

Calculate net PnL, ROE, fees and gross profit/loss for a futures trade. Edge cases: entryPrice, exitPrice and size above zero; feeOpenPct and feeClosePct optional fractions from 0 to 0.05 (0.0002 is 0.02%). For inverse contracts size is USD contracts and results are in the base coin. Not covered: funding payments, slippage, liquidation before the exit price is reached, and taxes. Use when user asks "what's my profit/loss on this trade?" Returns: grossPnl, fees, netPnl, netPnlUsdt, roe (%), maxLossBound (only non-null for an inverse/coin-margined short: the finite ceiling on net coin-denominated loss as price rises without limit, (size/entryPrice)×(1+feeOpenPct) - includes the opening fee, since it survives the exit-price-to-infinity limit while the closing fee vanishes - null for every other side/contractType combination, which either has no such bound or a trivial one).

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>",
      "exitPrice": "<exitPrice>",
      "size": "<size>"
    },
    "name": "workflow.run_pnl_planning"
  }
}

Input Schema

NameRequiredDescriptionDefault
sideYesTrade direction
sizeYesPosition size: base asset qty for linear, USD contracts for inverse
exitPriceYesExit price (positive)
entryPriceYesEntry price (positive)
feeOpenPctNoOpening fee as fraction, e.g. 0.0002 = 0.02%
feeClosePctNoClosing fee as fraction
contractTypeNolinear = USDT-margined (default), inverse = coin-margined. For inverse, pnl/fees are returned in the base coin, not USDT.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / size / description
      Previous value: -"Position size — base asset qty for linear, USD contracts for inverse"New value: +"Position size: base asset qty for linear, USD contracts for inverse"
  2. Changed2 schema fields changed
    • addedInput schema / properties / contractType
      Added value: +{
      +  "description": "linear = USDT-margined (default), inverse = coin-margined. For inverse, pnl/fees are returned in the base coin, not USDT.",
      +  "enum": [
      +    "linear",
      +    "inverse"
      +  ],
      +  "type": "string"
      +}
    • changedInput schema / properties / size / description
      Previous value: -"Position size in base asset"New value: +"Position size — base asset qty for linear, USD contracts for inverse"
  3. Added

TDQS

A4.3/5.0
Behavior5/5

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

With readOnlyHint already declaring the operation safe, the description adds substantial behavioral context: required positive prices and size, the optional fee range of 0 to 0.05, inverse-contract denomination in the base coin, and explicit exclusions. It also explains the special maxLossBound return condition and why it is null for other combinations, which is far beyond the annotations.

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?

The description is front-loaded with purpose, then structured into edge cases, exclusions, usage trigger, and returns. The returns section becomes dense, especially the long parenthetical explaining maxLossBound, but the detail is relevant for interpreting a non-obvious output field rather than filler.

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, so the description carries the return-value burden and does so by naming grossPnl, fees, netPnl, netPnlUsdt, roe, and maxLossBound. It also documents input assumptions, exclusions, and inverse-contract behavior, making the definition complete for a seven-parameter calculation tool.

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 baseline is 3, but the description adds constraints not present in the schema: entryPrice, exitPrice, and size must be above zero, and fees are optional fractions from 0 to 0.05 with a percentage example. It also reinforces that inverse-contract size is USD contracts and results are returned in the base coin.

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 uses a specific verb, 'Calculate,' and names the exact outputs and resource: net PnL, ROE, fees, and gross profit/loss for a futures trade. It implicitly differentiates from spot or forex PnL tools by scoping to futures and mentioning inverse contracts, but it does not explicitly name or rule out sibling alternatives.

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 provides a clear trigger phrase, 'Use when user asks what's my profit/loss on this trade?', and lists what the calculation does not cover, including funding, slippage, liquidation, and taxes. However, it does not route the agent between this and sibling PnL or planning tools such as forex PnL or crypto profit calculators.

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.