Skip to main content
Glama

gdex_manage_position

Read-only

Preview closing or reducing a perpetual position, or selling a spot token back to USDC, against live state before executing the trade.

Instructions

Preview an exit for an existing position, against its live state: close/reduce a perp (reduce-only, correct side for longs and shorts) or sell a spot token back to USDC. Returns a preview; execute it with gdex_execute_trade.

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": {
      "accountRef": "<accountRef>",
      "action": "<action>"
    },
    "name": "gdex_manage_position"
  }
}

Input Schema

NameRequiredDescriptionDefault
dexNo
coinNoperp coin for close/reduce
sizeNoreduce: contracts to close
chainNosell: chain
actionYes
amountNosell: token amount, or "all", "half", "25%" of the actual holding
accountRefYes
slippagePctNo
tokenAddressNosell: token

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv5.3.0
    • changedInput schema / properties / amount / description
      Previous value: -"sell: token amount"New value: +"sell: token amount, or \"all\", \"half\", \"25%\" of the actual holding"
    • changedInput schema / properties / amount / pattern
      Previous value: -"^\\d+(\\.\\d+)?$"New value: +"^(\\d+(\\.\\d+)?|all|half|\\d{1,3}%)$"
  2. Addedv5.1.0

TDQS

A3.7/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and openWorldHint=true, so the safety profile is known; the description adds real context on top: pricing is computed 'against its live state', perp exits are reduce-only and side-correct for longs and shorts, and the call returns a preview rather than executing. It does not disclose slippage defaults, auth requirements, or preview staleness/expiry, which keeps it below 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.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with the core purpose and mode enumeration, ending with the execution handoff. Every clause ('reduce-only', 'correct side for longs and shorts', 'live state') carries information an agent needs; 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 9-parameter tool with no output schema, the description covers the mode semantics and the preview-vs-execute distinction adequately. It omits what the preview actually returns (fees, price impact, expected fill), slippage behavior, and which parameters are required per action, which for a preview tool an agent must understand before trusting the result.

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?

With 56% schema description coverage, the description does useful work by mapping the three action modes to their parameters: coin for close/reduce, tokenAddress plus amount for sell. However, dex, chain, slippagePct, and size handling are left entirely to the schema, and slippagePct has no description anywhere, so the gap is only partially closed.

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: 'Preview an exit for an existing position', and enumerates the two exit modes (close/reduce a perp, sell a spot token back to USDC). This distinguishes it from executor siblings like gdex_execute_trade. It does not, however, contrast itself with gdex_preview_trade or the close_perp_position family, which an agent could easily confuse with it.

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?

It gives a clear usage chain — call this to preview, then call gdex_execute_trade to execute — which is genuinely useful routing. But it never says when NOT to use it, and overlaps heavily with close_perp_position and close_all_positions, which are not mentioned as alternatives. Usage is implied rather than fully scoped.

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

Deploy Server

Other Tools