Skip to main content
Glama

减少保证金

build_remove_margin
Read-only

Builds a transaction to withdraw excess margin from an existing position without reducing notional size, supporting USDC and meme-token collateral within leverage and $2 minimum-margin limits.

Instructions

在不缩减持仓名义规模(sizeDeltaUsd = 0)的前提下,从已有仓位提取多余保证金(兼容 USDC 本位与 Meme 币本位;仅可提取超出最高杠杆要求且满足链上最低 2 USD 保底线门槛的自有本金,未实现浮盈需平仓提取)。

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>"
    },
    "name": "build_remove_margin"
  }
}

Input Schema

NameRequiredDescriptionDefault
sideYeslong 做多,short 做空
agentNoagent 专用通道:填 agent 自己的钱包地址后,交易由 agent 用自己的私钥直接签名发送,不用用户逐笔确认(用户需先用 build_agent_authorize 授权这个地址)。不填则由用户钱包签名
marketYes市场:短链接 slug、市场合约地址、代币地址、代币代号,或标的代号如 BTC / ETH / XAU(表示该标的的官方市场)
accountYes用户钱包地址(交易的签名人和收款人)
collateralUsdcNo提取的保证金金额(USDC 本位填 USDC 数量;Meme 币本位可按美元估算自动换算代币数,或直接传 collateralTokens)
collateralTokensNo仅 Meme 币本位永续市场使用:直接指定提取的 Meme 代币数量

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.8/5.0
Behavior3/5

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

Adds real behavioral value beyond the annotations: the leverage headroom limit, the 2 USD minimum, and the rule that unrealized profit cannot be withdrawn. However it never explains the build-and-sign action model (the 'build_' family returns an unsigned transaction; the agent param bypasses per-trade confirmation), which is unresolved tension with readOnlyHint=true for what is semantically a position mutation.

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 sentence, front-loaded with the core invariant (sizeDeltaUsd = 0) before the qualifiers. The nested parenthetical is dense but each clause carries a distinct constraint; no filler.

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 6-parameter transaction builder with no output schema, the description covers preconditions well but omits what is returned (an unsigned transaction) and what happens on failure, e.g. when the requested withdrawal breaches the leverage threshold. An agent still has to guess the call-and-sign flow.

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 every parameter (side, market, account, agent, collateralUsdc, collateralTokens) is already documented in the schema. The description only echoes the USDC-quoted vs Meme-quoted collateral distinction already stated on collateralUsdc/collateralTokens, adding no new syntax or unit guidance.

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?

States a specific verb and resource (extract excess margin from an existing position) and pins the defining mechanic: sizeDeltaUsd = 0, i.e. notional size is unchanged. That single clause separates it cleanly from build_add_margin and build_close_position without naming them.

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

Usage Guidelines4/5

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

Gives concrete eligibility conditions: only own capital in excess of the max-leverage requirement, only above the on-chain 2 USD floor, and unrealized PnL must be realized by closing first. These effectively say when the tool will succeed, though no sibling alternative is named for the adjacent 'add margin' case.

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