Skip to main content
Glama

Prepare margin remove

perps_prepare_margin_remove
Read-only

Previews removing margin from an open position. Read-only safety gate: runs risk checks and returns a short-lived confirmation token (~90s). Present the summary, get explicit user confirmation, then call perps_execute_operation with the token. Makes no changes itself. Check perps_get_margin_remove_limits first; execution is async, so poll perps_get_margin_task_status with the returned task_id.

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": {
      "contractId": "<contractId>"
    },
    "name": "perps_prepare_margin_remove"
  }
}

Input Schema

NameRequiredDescriptionDefault
isMaxNoAdjust by the maximum amount the position allows, ignoring amount.
amountNoMargin to be removed from the position, in USDT, as a decimal string. Required unless isMax is true. Below the contract's minimum adjust amount, execution fails with agent.margin.invalid_amount.
contractIdYesNumeric contract id from perps_list_contracts with an open position. 0 is a real contract id, not a placeholder for "unset".

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, and the description adds genuinely new behavior: risk checks are run, the confirmation token is short-lived (~90s), the tool makes no changes itself, and execution downstream is asynchronous. Those are non-obvious operational constraints an agent must know to avoid stalling or reusing an expired token.

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?

Five short sentences, front-loaded with what the tool does and what it does not do, followed by the sequencing steps. No filler or restated title.

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?

No output schema exists, yet the description tells the agent what comes back (a confirmation token, and a task_id for polling) and how to consume each. Combined with the annotated safety profile and fully documented params, nothing needed to call it correctly is missing.

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%, including the non-obvious note that contractId 0 is a real id and the isMax/amount interaction, so the schema already carries parameter meaning. The description adds nothing further about amount formatting or isMax precedence, so the baseline 3 applies.

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 ('Previews removing margin from an open position') and immediately frames the tool's role as a read-only safety gate. It distinguishes itself from perps_execute_operation and from the sibling limits/status tools by naming them in the flow.

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?

Gives an explicit ordered procedure: check perps_get_margin_remove_limits first, then call this, present the summary, get explicit user confirmation, then call perps_execute_operation with the token, then poll perps_get_margin_task_status. The alternative path (execute directly) is ruled out by the confirmation-token requirement.

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