Skip to main content
Glama

Size a position by risk

size_position
Read-onlyIdempotent

Turns "risk 1% of equity, stop 2% below" into a size in the base coin, rounded down to the venue step and capped by every limit; reads equity, price and contract rules itself. Use before preview_order. Not an order: preview and execute after it. Give the stop once and the amount once (see the inputs). Example: {"symbol": "BTC", "side": "buy", "stop_distance_pct": 0.02, "risk_pct_of_equity": 0.01}. Next: preview_order with preview_args from the result.

Input Schema

NameRequiredDescriptionDefault
sideYesbuy = long, sell = short
venueNoVenue: sandbox, hyperliquid, okx, bybit or binance. Omitted: the agent's only venue, else hyperliquid if connected, else your only connected exchange, else the sandbox
symbolYesBase coin, e.g. BTC
stop_lossNoThe stop as a price, USD per coin: below entry for a long, above for a short. Or give stop_distance_pct
entry_priceNoPlanned entry, USD per coin (a limit or trigger price); omitted: the mark
notional_usdNoOr the position's value in USD ("buy $200 worth"), instead of risk_pct_of_equity; still capped by the risk limits
stop_distance_pctNoThe stop as a distance from entry, a fraction of the price (0.02 = 2% away), instead of stop_loss
risk_pct_of_equityNoHow much of equity to lose if the stop fills (0.01 = 1%). Omit it and notional_usd for the most your limits allow

Output Schema

NameRequiredDescriptionDefault
sideYesbuy (long) or sell (short)
venueYesVenue name
symbolYesBase coin
risk_usdYesLoss if the stop fills, USD
capped_byYesWhich limit made the size smaller than asked, if any
size_baseYesSuggested size, in the base coin (e.g. BTC), not USD, rounded down to the venue's size step; pass it to preview_order as size_base
stop_lossYesStop-loss used, USD per coin
equity_usdYesEquity used for the calculation (the venue's book), USD
deprecationNoPresent only while this tool is deprecated: replacement, removal_date, changelog
entry_priceYesEntry used, USD per coin (the mark when not given)
notional_usdYessize_base x entry, USD
preview_argsYesThe arguments for preview_order with this size: symbol, side, size_base, stop_loss, venue and leverage (5, or less where a limit says so); add price and order_type for a limit order
within_limitsYesFalse if even the capped size cannot pass (e.g. below the venue minimum)
risk_pct_of_equityYesrisk_usd / equity, as a fraction

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • removedInput schema / properties / venue / default
      Removed value: -"hyperliquid"
  2. Added

TDQS

A4.5/5.0
Behavior4/5

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

Beyond the readOnlyHint/idempotent annotations it discloses real behavior: it fetches equity, price and contract rules itself, rounds size down, and caps against every limit. What is not covered is failure behavior or permission requirements when the underlying reads fail or a venue is not connected.

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 core transformation and its rounding/capping caveats come first, followed by workflow routing, the exclusivity note, and a compact example. Every sentence carries information; nothing is redundant with the title.

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?

For an 8-parameter computation tool with full schema coverage and an output schema, the description covers purpose, side effects, data dependencies, exclusivity of inputs, and the follow-up call. 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.

Parameters3/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 every parameter and its alternatives. The description adds a useful disambiguation rule ('give the stop once and the amount once') and a concrete worked example that maps values to the mutually exclusive fields, but that is a modest lift over an already complete schema.

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 concrete transformation (risk % of equity + stop → size in base coin), plus the modifiers that matter: rounded down to venue step and capped by every limit. It also explicitly says it is not an order, which separates it cleanly from preview_order and execute_previewed_order.

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?

Gives an explicit ordering rule: call this before preview_order, then preview and execute after. It also names the next call and where its argument comes from (preview_args from the result), leaving no ambiguity about the workflow position of this tool.

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.

Resources