Skip to main content
Glama

Position size from risk

position_size
Read-onlyIdempotent

Works out how big a trade can be so that hitting the stop-loss loses only the chosen share of the account, fees included, plus the margin needed at a given leverage and whether liquidation comes before the stop. Pure calculation.

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": {
      "account": "<account>",
      "risk_pct": "<risk_pct>",
      "entry": "<entry>",
      "stop": "<stop>"
    },
    "name": "position_size"
  }
}

Input Schema

NameRequiredDescriptionDefault
stopYesStop-loss price. Below the entry for a long, above it for a short; the side is read from this.
entryYesPlanned entry price.
accountYesAccount size in USD.
fee_pctNoFee per side in percent. Default 0.05.
leverageNoLeverage used to work out the margin needed. Optional, default 1 (no leverage).
risk_pctYesShare of the account to risk, in percent (e.g. 1).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • addedInput schema / properties / entry / description
      Added value: +"Planned entry price."
    • changedInput schema / properties / leverage / description
      Previous value: -"Optional. Default 1."New value: +"Leverage used to work out the margin needed. Optional, default 1 (no leverage)."
    • addedInput schema / properties / stop / description
      Added value: +"Stop-loss price. Below the entry for a long, above it for a short; the side is read from this."
  2. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, non-destructive, and closed-world, so the safety profile is covered. The description adds genuinely complementary behavior: fees are folded into the risk math, margin is derived from leverage, and the result reports whether liquidation precedes the stop. It does not discuss precision, rounding, or error conditions for invalid stop/entry combos.

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?

Two sentences, no filler, and the core constraint is front-loaded. The first sentence is dense, packing three distinct outputs into one clause chain, which slightly hurts scannability but wastes no words.

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, and the description compensates by enumerating the three values returned: position size, required margin, and a liquidation-before-stop flag. With six parameters fully documented in the schema and annotations covering safety, an agent has everything needed to call this 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 adds real meaning by tying fee_pct to the loss calculation and leverage to the margin requirement, showing how those optional inputs change the answer rather than just what they are. The side-inference rule is left to the schema's stop description.

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 ('works out how big a trade can be') with the exact governing constraint (stop-loss loss equals a chosen share of the account) and names the three quantities produced: size, margin at leverage, and liquidation-before-stop. That is enough for an agent to distinguish it from liquidation_price or leverage_survival, which answer narrower questions.

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?

The implicit trigger is clear from the description: plan a trade size given entry, stop, and risk tolerance. 'Pure calculation' tells the agent there are no side effects and no state to set up. It stops short of explicitly saying when to prefer it over the sibling liquidation_price tool, which overlaps on the liquidation question.

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.