Skip to main content
Glama

设置止盈止损

build_set_tp_sl
Read-only

为已有仓位设置止盈和 / 或止损:同一笔交易里先撤掉该仓位原有的止盈止损,再按新价格挂单(仓位平掉时另一张自动撤)。

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>",
      "market": "<market>",
      "side": "<side>",
      "slippagePct": "<slippagePct>"
    },
    "name": "build_set_tp_sl"
  }
}

Input Schema

NameRequiredDescriptionDefault
sideYeslong 做多,short 做空
agentNoagent 专用通道:填 agent 自己的钱包地址后,交易由 agent 用自己的私钥直接签名发送,不用用户逐笔确认(用户需先用 build_agent_authorize 授权这个地址)。不填则由用户钱包签名
marketYes市场:短链接 slug、市场合约地址、代币地址、代币代号,或标的代号如 BTC / ETH / XAU(表示该标的的官方市场)
accountYes用户钱包地址(交易的签名人和收款人)
stopLossNo
takeProfitNo
slippagePctYes滑点百分数,默认 0.3(即 0.3%)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / properties / stopLoss / maximum
      Added value: +1000000000000
    • addedInput schema / properties / takeProfit / maximum
      Added value: +1000000000000
  2. Changed3 schema fields changed
    • removedInput schema / properties / market / maxLength
      Removed value: -80
    • removedInput schema / properties / market / minLength
      Removed value: -1
    • removedInput schema / properties / market / type
      Removed value: -"string"
  3. First observed

TDQS

B3.4/5.0
Behavior3/5

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

The description adds genuinely useful behavior beyond the annotations: existing TP/SL orders are cancelled before the new ones are placed, and the paired order auto-cancels when the position closes. That is real OCO semantics and matches the non-idempotent hint. Some tension remains, though: the text describes cancelling orders, while the annotations declare readOnlyHint=true and destructiveHint=false; this is defensible only if the tool merely builds an unsigned transaction, and the description does not say so.

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 definition is a single tight sentence that front-loads the core action and then explains the replace behavior. No filler, but the compactness leaves out prerequisite and unit details.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 7-parameter mutation-builder with no output schema, the description covers the cancel-and-replace behavior but omits how the target position is identified. It does not say that account + market + side select the existing position, and it omits the price unit and the result when no position exists. These gaps are real but minor for a transaction-builder tool.

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?

The phrase '止盈和 / 或止损' clarifies that takeProfit and stopLoss are each optional and can be used alone or together; the schema does not document either of them. The description does not explain the price unit or whether a single-sided order is allowed, despite schema coverage of 71%.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description gives a specific verb and resource: set take-profit and/or stop-loss on an existing position. It is clear what the tool operates on ('已有仓位') and does not merely restate the title. It never contrasts itself with siblings like build_open_position or build_close_position, so the differentiation is implied rather than stated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The prerequisite ('已有仓位') is clear, which keeps the agent from calling it without a position. However, there is no guidance on what to do if no position exists, no mention of alternative tools that also attach TP/SL when opening a position, and no note on preconditions such as the agent authorization flow.

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