Skip to main content
Glama

close_perp_position

Destructive

Close a perp position (full/partial) on its venue (non-custodial).

position_id is venue-native (for Drift it is the market symbol). close_pct in (0, 100]. Returns an UNSIGNED tx / signing payload to sign + broadcast.

jurisdiction: closes are geo-gated too -- see place_perp_order.

idempotency_key (optional): a client-generated UUID. Retrying with the same key + same args replays the original result instead of re-closing the position. Reuse the SAME key across the build call and its signed_transaction completion call -- see place_perp_order; the two legs dedupe independently, so this never raises IDEMPOTENCY_CONFLICT.

signed_transaction / verify (two-phase execution): see place_perp_order -- re-call with the signed payload and Crank relays it by custody tier and verifies the result.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ipNo
venueNo
verifyNo
caller_idNo
close_pctNo
position_idYes
jurisdictionNo
pay_in_crankNo
payment_headerNo
wallet_addressYes
idempotency_keyNo
acknowledge_tier_bNo
signed_transactionNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

TDQS

A3.6/5.0
Behavior5/5

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

Despite destructiveHint and non-idempotent annotations, the description adds substantial behavioral context beyond them: it explicitly says the tool returns an UNSIGNED transaction/payload, closes are geo-gated, the two-phase signed_transaction flow is supported, and idempotency_key replays the original result. This greatly helps the agent understand side effects and execution phases.

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?

The description is organized with parameter-scoped notes and front-loads the core purpose before getting into idempotency and two-phase execution. It is somewhat long and repeats the place_perp_order reference multiple times, but each sentence contributes behavioral or safety-relevant information.

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?

The tool is complex (13 parameters) and the schema descriptions are absent, so the description carries a heavy burden. It covers the behavioral flow well, but leaves several defaulted and non-defaulted parameters unexplained and relies heavily on a sibling tool for crucial two-phase execution details. An output schema exists, but input semantics for parameters like wallet_address and pay_in_crank remain incomplete.

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 0%, so the tool description must carry the parameter meaning; it does a good job for close_pct, position_id, jurisdiction, idempotency_key, verify, and signed_transaction. However, important parameters such as wallet_address, venue, pay_in_crank, payment_header, and acknowledge_tier_b receive no meaningful explanation, and the description defers a fair amount to place_perp_order rather than being self-contained.

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 action ('Close a perp position'), the resource, and the full/partial scope, and it adds important context about non-custodial venue settlement and unsigned signing payloads. It does not explicitly distinguish itself from close-related siblings such as perp_close, so it falls just short of full differentiation.

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

Usage Guidelines2/5

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

The description explains mechanics like idempotency, jurisdiction, and two-phase execution, but it does not state when to choose this tool versus alternatives such as perp_close, cancel_perp_order, or perp_modify. It also does not mention when not to use the tool, aside from implicitly being for closing perp positions.

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.

TDQS

B3.2/5.0
Disambiguation2/5

Multiple tools overlap significantly: close_perp_position vs perp_close, get_leaderboard vs get_score_leaderboard vs get_strategy_leaderboard, get_venue_status vs get_all_venues_status, send_token_social vs bulk_send_social, and get_crank_score vs get_score. Several read-only tools have nearly identical purposes, and the descriptions do not always clarify boundaries.

Naming Consistency4/5

Most tools follow a consistent verb_noun snake_case pattern (get_balances, create_strategy, set_alert, list_webhooks). However, there are deviations like 'lst_swap', 'jupiter_swap', 'flash_loan', 'sr_backtest', and the use of both 'get_' and 'list_' for reads, plus category prefixes like 'perp_' and 'strategy_' that vary in order. Overall still readable and predictable.

Tool Count1/5

177 tools is an extreme count for any server, far exceeding the 25+ threshold for 'too many'. Even a full DeFi platform does not need this many separate operations; the surface is overwhelming and clearly not well-scoped.

Completeness3/5

The domain (Solana DeFi trading) is covered extensively across swaps, perps, lending, staking, strategies, signals, and support. However, there are notable gaps: no lend_withdraw, no direct way to close a lending position, no spot order cancellation (though aggregator-based swaps may not need it), and a general lack of tiered account management. The huge number of tools makes it hard to identify missing lifecycle steps.

Resources