Skip to main content
Glama

设置止盈止损

build_set_tp_sl
Read-only

Sets take-profit and stop-loss orders for an existing position by replacing prior orders in one transaction; the remaining order auto-cancels when the position closes.

Instructions

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

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. First observedv1.0.0

TDQS

B3/5.0
Behavior1/5

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

The description describes cancelling the position's existing TP/SL orders and placing new ones — a state-mutating, order-cancelling operation — while annotations declare readOnlyHint=true and destructiveHint=false. That is a direct contradiction. The description itself does contain genuinely useful behavior (atomic cancel-then-place in one transaction, sibling order auto-cancelled when the position closes), but the conflict with the structured safety hints is disqualifying.

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?

A single dense sentence that front-loads the target (existing position) and then the transactional behavior. Every clause carries information; nothing is padding.

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 order-placement tool with no output schema, the description covers the important mechanics (replace-not-add, atomicity, auto-cancel on close) but leaves open what happens if only one of takeProfit/stopLoss is supplied, whether omitting both is valid, and what the response returns. Adequate but with real gaps.

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 71%, with market, side, agent and slippagePct already documented inline. The description contributes one meaningful disambiguation the schema lacks: '按新价格挂单' establishes that takeProfit and stopLoss are price levels rather than percentages or distances, which the bare number/exclusiveMinimum:0 schema does not say.

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 states a specific verb and resource (设置止盈和/或止损) and scopes it to 已有仓位, which cleanly separates it from the build_open_position / build_close_position family. It does not name a sibling alternative explicitly, so it stops short of a 5.

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 '为已有仓位' implies you must already hold a position, and the atomic replace semantics imply this is the way to modify rather than stack TP/SL. But there is no explicit when-not guidance and no named alternative for removing TP/SL without setting new ones.

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