Skip to main content
Glama

Let a position's stop follow the price

set_stop_loss_rule
Idempotent

Make a held position's stop-loss move by itself, only ever toward the price: trailing (it follows the best price at trail_pct behind it) or breakeven (it moves to the entry once the price reaches activate_at). TradeHub checks about every 5 seconds; each move follows tighten_stop_loss's rules and is audited. Use to lock in profit on a winning position. One rule per position: a new one replaces it, kind=none removes it, it ends when the position closes. Not for a one-off move (use tighten_stop_loss). Next: get_my_open_positions shows the rule.

Input Schema

NameRequiredDescriptionDefault
kindYestrailing: the stop follows the best price at trail_pct behind it; breakeven: the stop moves to the entry once the price reaches activate_at; none: remove the rule
venueNoVenue: sandbox, hyperliquid, okx, bybit or binance. Omitted: the agent's only venue, else hyperliquid, else your only connected venue, else sandboxhyperliquid
symbolYesBase coin, e.g. BTC
trail_pctNotrailing only: distance behind the best price as a fraction, 0.001-0.2 (0.02 = 2%)
activate_atNoPrice, USD per coin, from which the rule acts; required for breakeven (beyond the entry on the profit side), optional for trailing

Output Schema

NameRequiredDescriptionDefault
okYesTrue when the rule is stored
ruleYesThe rule now following the position; null after kind=none
venueYesVenue name
symbolYesBase coin
deprecationNoPresent only while this tool is deprecated: replacement, removal_date, changelog

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed52 schema fields changed
    • removedInput schema / properties / activate_at / anyOf
      Removed value: -[
      -  {
      -    "exclusiveMinimum": 0,
      -    "type": "number"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedInput schema / properties / activate_at / default
      Removed value: -null
    • addedInput schema / properties / activate_at / exclusiveMinimum
      Added value: +0
    • removedInput schema / properties / activate_at / title
      Removed value: -"Activate At"
    • addedInput schema / properties / activate_at / type
      Added value: +[
      +  "number",
      +  "null"
      +]
    • removedInput schema / properties / kind / title
      Removed value: -"Kind"
    • removedInput schema / properties / symbol / title
      Removed value: -"Symbol"
    • removedInput schema / properties / trail_pct / anyOf
      Removed value: -[
      -  {
      -    "maximum": 0.2,
      -    "minimum": 0.001,
      -    "type": "number"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedInput schema / properties / trail_pct / default
      Removed value: -null
    • addedInput schema / properties / trail_pct / maximum
      Added value: +0.2
    • addedInput schema / properties / trail_pct / minimum
      Added value: +0.001
    • removedInput schema / properties / trail_pct / title
      Removed value: -"Trail Pct"
    • addedInput schema / properties / trail_pct / type
      Added value: +[
      +  "number",
      +  "null"
      +]
    • removedInput schema / properties / venue / title
      Removed value: -"Venue"
    • removedInput schema / title
      Removed value: -"set_stop_loss_ruleArguments"
    • removedOutput schema / $defs / StopRuleOut / properties / activate_at / anyOf
      Removed value: -[
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / $defs / StopRuleOut / properties / activate_at / default
      Removed value: -null
    • removedOutput schema / $defs / StopRuleOut / properties / activate_at / title
      Removed value: -"Activate At"
    • addedOutput schema / $defs / StopRuleOut / properties / activate_at / type
      Added value: +[
      +  "number",
      +  "null"
      +]
    • removedOutput schema / $defs / StopRuleOut / properties / best_price / anyOf
      Removed value: -[
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / $defs / StopRuleOut / properties / best_price / default
      Removed value: -null
    • removedOutput schema / $defs / StopRuleOut / properties / best_price / title
      Removed value: -"Best Price"
    • addedOutput schema / $defs / StopRuleOut / properties / best_price / type
      Added value: +[
      +  "number",
      +  "null"
      +]
    • addedOutput schema / $defs / StopRuleOut / properties / deprecation / additionalProperties
      Added value: +true
    • removedOutput schema / $defs / StopRuleOut / properties / deprecation / anyOf
      Removed value: -[
      -  {
      -    "additionalProperties": true,
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / $defs / StopRuleOut / properties / deprecation / default
      Removed value: -null
    • removedOutput schema / $defs / StopRuleOut / properties / deprecation / title
      Removed value: -"Deprecation"
    • addedOutput schema / $defs / StopRuleOut / properties / deprecation / type
      Added value: +[
      +  "object",
      +  "null"
      +]
    • removedOutput schema / $defs / StopRuleOut / properties / kind / title
      Removed value: -"Kind"
    • removedOutput schema / $defs / StopRuleOut / properties / last_stop / anyOf
      Removed value: -[
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / $defs / StopRuleOut / properties / last_stop / default
      Removed value: -null
    • removedOutput schema / $defs / StopRuleOut / properties / last_stop / title
      Removed value: -"Last Stop"
    • addedOutput schema / $defs / StopRuleOut / properties / last_stop / type
      Added value: +[
      +  "number",
      +  "null"
      +]
    • removedOutput schema / $defs / StopRuleOut / properties / moves / title
      Removed value: -"Moves"
    • removedOutput schema / $defs / StopRuleOut / properties / rule_id / title
      Removed value: -"Rule Id"
    • removedOutput schema / $defs / StopRuleOut / properties / status / title
      Removed value: -"Status"
    • removedOutput schema / $defs / StopRuleOut / properties / symbol / title
      Removed value: -"Symbol"
    • removedOutput schema / $defs / StopRuleOut / properties / trail_pct / anyOf
      Removed value: -[
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / $defs / StopRuleOut / properties / trail_pct / default
      Removed value: -null
    • removedOutput schema / $defs / StopRuleOut / properties / trail_pct / title
      Removed value: -"Trail Pct"
    • addedOutput schema / $defs / StopRuleOut / properties / trail_pct / type
      Added value: +[
      +  "number",
      +  "null"
      +]
    • removedOutput schema / $defs / StopRuleOut / properties / venue / title
      Removed value: -"Venue"
    • removedOutput schema / $defs / StopRuleOut / title
      Removed value: -"StopRuleOut"
    • addedOutput schema / properties / deprecation / additionalProperties
      Added value: +true
    • removedOutput schema / properties / deprecation / anyOf
      Removed value: -[
      -  {
      -    "additionalProperties": true,
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / properties / deprecation / default
      Removed value: -null
    • removedOutput schema / properties / deprecation / title
      Removed value: -"Deprecation"
    • addedOutput schema / properties / deprecation / type
      Added value: +[
      +  "object",
      +  "null"
      +]
    • removedOutput schema / properties / ok / title
      Removed value: -"Ok"
    • removedOutput schema / properties / symbol / title
      Removed value: -"Symbol"
    • removedOutput schema / properties / venue / title
      Removed value: -"Venue"
    • removedOutput schema / title
      Removed value: -"StopRuleSet"
  2. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Beyond the annotations (which only cover read-only/idempotency/destructiveness), it discloses the ~5 second polling cadence, that each move follows tighten_stop_loss's rules, that moves are audited, and that rules self-terminate when the position closes. What's missing is failure behavior (e.g., what happens if the position is already past activate_at) and confirmation of the response shape, but the behavioral surface is otherwise well covered.

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 purpose and the two modes are front-loaded, then lifecycle, then exclusion, then next step — a sensible ordering with no filler. It is a dense single block, but each clause carries distinct information.

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?

With an output schema present, the description needn't explain returns, and it covers timing, lifecycle, alternatives, and intent. An agent has everything needed to decide between this and tighten_stop_loss and to invoke it correctly.

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 coverage is 100% and the schema already explains kind modes, trail_pct range/meaning, and activate_at's requirement for breakeven. The description's parenthetical restates the schema's enum semantics rather than adding new meaning, so baseline 3 applies.

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?

The description names the specific verb and resource ('make a held position's stop-loss move by itself') and immediately splits the two modes, trailing vs breakeven, with the mechanism for each. It also explicitly contrasts with the sibling tighten_stop_loss, so an agent can distinguish the two 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?

It states when to use it ('lock in profit on a winning position'), when not to ('Not for a one-off move (use tighten_stop_loss)'), and names the follow-up tool (get_my_open_positions). Lifecycle rules — one rule per position, replacement on re-call, kind=none removal, termination on close — are all spelled out.

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