Skip to main content
Glama

set_leverage

Destructive

Sets a coin's leverage on the live account, capped by the risk profile, to adjust an open position or prepare a market before trading. Confirm changes with get_positions.

Instructions

LIVE MONEY: acts on the real account. Set a coin's leverage, a whole number from 1 up to the coin's max (default 5 when omitted). It is capped by the risk profile's max_leverage and refused above it (raise the cap with update_config first). An open position keeps its own margin type (cross or isolated); a venue refusal, such as leverage too low for the margin in use, comes back as an error. place_bracket already sets leverage when given one, so call this alone only to change an open position or prepare a coin. Confirm with get_positions. Needs a trading key. Returns {ok, coin, leverage} or the error.

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": {
      "coin": "<coin>"
    },
    "name": "set_leverage"
  }
}

Input Schema

NameRequiredDescriptionDefault
coinYesCoin: a main-dex perp by name (BTC, ETH) or a HIP-3 perp as dex:SYMBOL (xyz:GOLD, xyz:BRENTOIL).
leverageNoWhole number from 1 to the coin's max, at most the profile cap (default 5 when omitted).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.6.1
    • changedInput schema / properties / coin / description
      Previous value: -"Coin ticker (e.g. BTC)"New value: +"Coin: a main-dex perp by name (BTC, ETH) or a HIP-3 perp as dex:SYMBOL (xyz:GOLD, xyz:BRENTOIL)."
    • changedInput schema / properties / leverage / description
      Previous value: -"Leverage value (default 5)"New value: +"Whole number from 1 to the coin's max, at most the profile cap (default 5 when omitted)."
  2. First observedv0.1.0

TDQS

A4.4/5.0
Behavior3/5

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

The description goes well past the single destructiveHint annotation: it discloses that this is real money on the live account, that the value is clamped by a risk-profile cap and refused above it, that an open position retains its own cross/isolated margin type, that venue refusals surface as errors, and that a trading key is required. It also states the return shape. It stops short of disclosing reversibility or whether an existing position's margin is re-derived, so it is strong but not exemplary against a mutation tool.

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?

Front-loaded with the highest-stakes fact (live money) and then ordered by decision relevance: cap, open-position behavior, sibling overlap, confirmation, auth, return value. It is one dense paragraph that reads as a run-on, but every sentence carries a distinct operational fact and nothing is padding.

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 a two-parameter live-trading mutation with no output schema, the definition covers auth requirements, cap enforcement and its remedy, margin-type side effects, error behavior, the return shape, and a confirmation step. An agent has everything needed to call it correctly and to know what happens when it fails.

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% and the schema already defines both fields including the default of 5 and the profile cap, so the baseline is 3. The description adds real meaning beyond that by explaining the failure mode when the cap is exceeded and naming update_config as the remedy, which the schema does not say.

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 ("Set a coin's leverage") and immediately scopes it as a live-account mutation. It differentiates from the sibling that overlaps most (place_bracket) by explaining that place_bracket already sets leverage, so an agent can pick correctly without opening either schema.

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 explicit when-to-use conditions ("only to change an open position or prepare a coin") and names the alternative that covers the other case. It also documents the blocking prerequisite (cap enforced by the risk profile; raise it with update_config first) and a verification step with get_positions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.