Skip to main content
Glama

平仓

build_close_position
Read-only

生成市价平仓交易(兼容 USDC 本位与 Meme 币本位),默认全平;传 sizeUsd 可部分平仓(按比例取回保证金)。

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_close_position"
  }
}

Input Schema

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

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / sizeUsd / maximum
      Added value: +10000000000
  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

A3.6/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, matching the fact that this only builds a transaction rather than sending it. The description adds real context beyond that: market order type, both collateral flavors supported, and that partial closes return margin proportionally. It omits the signing path (user wallet vs. agent key) and what the caller receives, which for a transaction builder is notable.

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?

One compact sentence with the default behavior front-loaded and the parameter-driven variation in a subordinate clause. Nothing is wasted, though the parenthetical collateral note competes with the core instruction for attention.

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 six-parameter transaction builder with full schema coverage and no output schema, the description supplies the one decision the schema cannot: the default-vs-partial closing rule. The remaining gaps (return shape, signing flow) are already carried by the schema and annotations.

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%, so the schema already documents side, market, account, agent, sizeUsd, and slippagePct. The description adds marginal semantic value only for sizeUsd, clarifying that partial closes reclaim margin proportionally; the other five parameters are covered entirely by the schema.

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?

States a specific verb and resource (生成市价平仓交易) and scopes it to market-order closes across USDC-collateral and Meme-collateral perps, which distinguishes it from build_open_position and the margin builders. It does not explicitly name any sibling, so differentiation is by domain vocabulary rather than by routing.

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?

Gives a usable default rule (omit sizeUsd = full close, pass sizeUsd = partial close) but no guidance on when to pick this over build_set_tp_sl, build_trigger_settlement, or build_add_margin/remove_margin for adjusting exposure. The when-to-use is implied by the tool name rather than stated.

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