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_positions shows the rule.

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": {
      "symbol": "<symbol>",
      "kind": "<kind>"
    },
    "name": "set_stop_loss_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 if connected, else your only connected exchange, else the sandbox
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. Changed1 schema field changed
    • removedInput schema / properties / venue / default
      Removed value: -"hyperliquid"
  2. Changed1 schema field changed
    • changedInput schema / properties / venue / description
      Previous value: -"Venue: sandbox, hyperliquid, okx, bybit or binance. Omitted: the agent's only venue, else hyperliquid, else your only connected venue, else sandbox"New value: +"Venue: sandbox, hyperliquid, okx, bybit or binance. Omitted: the agent's only venue, else hyperliquid if connected, else your only connected exchange, else the sandbox"
  3. 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"
  4. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Beyond the annotations (readOnlyHint=false, idempotentHint=true, destructiveHint=false), it discloses the polling cadence (~5 s), the audit trail, the one-rule-per-position cardinality, that a new rule replaces the old, that kind=none removes it, and that the rule dies when the position closes. That is substantive lifecycle and replacement behavior an agent could not infer from 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.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose and rule kinds come first, then runtime behavior, then usage/exclusion, then next step — a clean front-loaded progression. The density is high but nearly every clause carries distinct information; there is no 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?

For a mutating, scheduled, state-carrying tool, the description covers trigger mechanics, timing, replacement semantics, and termination. An output schema exists, so return values need no explanation, and the annotations cover the safety profile.

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 trail_pct, activate_at, venue and symbol are already documented in the schema and the description largely restates the trail_pct/activate_at mechanics. The one piece of added meaning, that kind=none removes the rule, is already implied by the enum text. Baseline 3 applies when the schema does the heavy lifting.

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 opening clause states a specific verb and resource — a held position's stop-loss that moves itself — and immediately partitions it into the two rule kinds (trailing vs breakeven) with their trigger mechanics. A reader can distinguish it from tighten_stop_loss 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 gives an affirmative use case ("lock in profit on a winning position"), an explicit exclusion with a named alternative ("Not for a one-off move (use tighten_stop_loss)"), and a follow-up route (get_my_positions shows the rule). Both the when and the when-not are stated outright.

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