Skip to main content
Glama

trade_close

Close an existing perpetual futures position on a supported exchange via a reduce-only market order after previewing impact and confirming; residual partial fills are flagged for review.

Instructions

Close an existing position. IMPORTANT: Call trade_preview first with the opposite side to show impact, then get user confirmation. Verified close: closedSize is the measured / venue-final fill (one residual market close is attempted); a residual still open → ORDER_PARTIAL error (symbol quarantined). Includes the uniform OrderResult of the reduce-only market order. Hyperliquid: native perps only (HIP-3 dexes via the CLI --dex).

Input Schema

NameRequiredDescriptionDefault
symbolYesSymbol to close (e.g., BTC, ETH)
exchangeYesExchange: pacifica, hyperliquid, lighter, aster, lighter-rh, ondo, arcus, qfex, risex, txflow (aliases accepted)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.17.0
    • changedInput schema / properties / exchange / description
      Previous value: -"Exchange: pacifica, hyperliquid, lighter, aster, lighter-rh, ondo, arcus, qfex (aliases accepted)"New value: +"Exchange: pacifica, hyperliquid, lighter, aster, lighter-rh, ondo, arcus, qfex, risex, txflow (aliases accepted)"
  2. Changed1 schema field changedv0.15.0
    • changedInput schema / properties / exchange / description
      Previous value: -"Exchange: pacifica, hyperliquid, lighter, aster, lighter-rh, ondo, arcus, qfex, risex (aliases accepted)"New value: +"Exchange: pacifica, hyperliquid, lighter, aster, lighter-rh, ondo, arcus, qfex (aliases accepted)"
  3. Changed1 schema field changedv0.14.3
    • changedInput schema / properties / exchange / description
      Previous value: -"Exchange: pacifica, hyperliquid, lighter, or aster"New value: +"Exchange: pacifica, hyperliquid, lighter, aster, lighter-rh, ondo, arcus, qfex, risex (aliases accepted)"
  4. Changed1 schema field changedv0.3.12
    • changedInput schema / properties / exchange / description
      Previous value: -"Exchange: pacifica, hyperliquid, or lighter"New value: +"Exchange: pacifica, hyperliquid, lighter, or aster"
  5. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does so well: it discloses that closedSize is a venue-final measured fill, that one residual market close is attempted, that a residual triggers ORDER_PARTIAL with symbol quarantine, and that Hyperliquid is native-perps-only. It omits what happens when no position exists and any permission/credential requirements, so not a 5.

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?

Purpose and the pre-call requirement are front-loaded, and every sentence carries operational content. It is dense with internal jargon (ORDER_PARTIAL, uniform OrderResult, --dex) that costs some readability but is not padding.

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

Completeness4/5

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

For a 2-parameter mutation tool with no annotations and no output schema, the description covers side effects, error mode, and return type adequately. Gaps are the no-position case and authorization expectations, which an agent may need before calling.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3; the description adds real constraint beyond the schema by narrowing the exchange parameter ('Hyperliquid: native perps only; HIP-3 dexes via the CLI --dex'). It adds nothing extra about symbol, but the exchange-side constraint justifies the bump.

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 ('Close an existing position') and reinforces the mechanics ('reduce-only market order'), which clearly separates it from trade_execute/trade_preview. It stops just short of explicitly contrasting itself with the execute sibling by name.

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 mandatory workflow: call trade_preview first with the opposite side, then obtain user confirmation. It names the alternative tool and the condition that selects it, leaving nothing to inference about ordering or approvals.

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