Skip to main content
Glama

perp_close

Destructive

Close a perp position, full or partial (non-custodial).

close_pct in (0, 100]. Returns an UNSIGNED base64 tx to sign + broadcast, plus exit price + realized P&L estimate (incl funding). Past the daily free tier an x402 payment_header is required.

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

idempotency_key (optional): a client-generated UUID. Retrying with the same key + same args replays the original result instead of re-closing the position.

signed_transaction / verify (two-phase execution): see perp_open_long -- re-call with the signed tx and Crank broadcasts it, confirms it on-chain, and re-reads the position.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ipNo
marketYes
verifyNo
caller_idNo
close_pctNo
position_idNo
jurisdictionNo
pay_in_crankNo
payment_headerNo
wallet_addressYes
idempotency_keyNo
signed_transactionNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

TDQS

A4/5.0
Behavior5/5

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

This is a strong area. With only destructiveHint=true and readOnlyHint=false available from annotations, the description compensates fully by disclosing that it returns an unsigned base64 tx, may require an x402 payment_header, supports replay via idempotency_key, and uses a signed_transaction/verify two-phase flow. It also flags jurisdiction geo-gating and realized P&L details.

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?

The description is dense but well-structured and front-loaded. The core purpose comes first, then each subsequent line adds one meaningful operational detail. Backticked parameter names and clear paragraphs make it easy to scan without waste.

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?

Given the tool's complexity, the description is quite complete: it covers the main return shape, fee requirements, jurisdiction gating, idempotency semantics, and two-phase execution with Crank. An output schema exists, so return-value documentation is mostly offloaded. The main gap is that positional parameters such as position_id and pay_in_crank are not contextualized, and the agent must infer their role from names alone.

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?

The schema has 0% property descriptions, so the description carries a key burden. It adds useful semantics for close_pct, idempotency_key, signed_transaction, verify, payment_header, and jurisdiction. However, it does not explain position_id selection, pay_in_crank, wallet_address, market, ip, or caller_id, even though some are core to correctly closing the intended position.

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 clearly states the verb and resource: 'Close a perp position, full or partial'. The non-custodial and unsigned-transaction details help set it apart from a custodial close flow, but it does not explicitly contrast it with the sibling close_perp_position, so some sibling differentiation is left implicit.

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?

The description conveys context for using the tool — full/partial close, non-custodial, fee tiers, idempotency, and two-phase execution — and directionally references perp_open_long. However, it never says when NOT to use this tool or explicitly names alternatives such as close_perp_position, cancel_perp_order, or perp_modify.

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