Skip to main content
Glama

zap_out_of_lp_position

Maps to POST /removeliquidity/quote. Builds a single-transaction zap to exit an LP position into ANY output token — you can withdraw into any token, not just the pool's underlying tokens. SwapWizard handles LP burn, fee collection, and intermediate swaps in a single transaction. Supports an optional affiliateCode (registered affiliate wallet address) forwarded to the API so the affiliate fee is paid on-chain to that address. REQUIRED WORKFLOW: First call list_user_lp_positions, then pass the returned fields (positionId, nftManager, dexName, liquidityKind) here along with sender, poolId, and withdrawals. EXECUTION FLOW: (1) APPROVE — For NFT-based positions, call setApprovalForAll(router, true) on the nftManager contract (do NOT use approve(router, tokenId)). For PCS Infinity BIN, call approveForAll(router, true). For classic LP pools (Curve, Balancer, Uniswap V2, Solidly), approve the LP token as a standard ERC-20. (2) WAIT for the approve tx to be confirmed on-chain. (3) Call this tool again for a fresh quote (quotes expire). (4) Send the tx to the router contract: to=router, data=callData, value=value. This requires a private key or wallet signer. ⚠️ PRICE IMPACT: The response includes a priceImpact field. Agents MUST present this value to the user and request explicit confirmation before executing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
poolIdNoPool identifier from search_liquidity_pools — pass if available.
senderYesWallet address of the position owner.
chainIdYesEVM chain ID
dexNameNoDEX project name from list_user_lp_positions (e.g. 'Uniswap V3', 'PancakeSwap V3', 'curve-dex').
percentNoPercentage of position to remove (default: 100). For classic LP pools (UniV2, Solidly, Curve, Balancer) use 99 instead of 100 to avoid reverts from LP balance race conditions between RPC nodes.
nftManagerNoNFT position manager contract address from list_user_lp_positions. Required for CL positions (Uniswap V3/V4, PancakeSwap V3/Infinity CL, SushiSwap V3, Algebra).
positionIdYesPosition identifier from list_user_lp_positions. For CL positions: NFT token ID. For classic pools: LP token contract address.
withdrawalsYesTokens to receive after removal
affiliateCodeNoOptional affiliate wallet address registered on-chain with SwapWizard — forwarded to the API so the affiliate fee for this operation is paid to that address. Omit if you have no affiliate.
liquidityKindNoLiquidity kind from list_user_lp_positions (e.g. UNIV3, UNIV4, ALGEBRA, SLIPSTREAM, PCS_INF_CL, CURVE, UNIV2, SOLIDLY).

TDQS

A4.7/5.0
Behavior5/5

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

No annotations exist, so the description fully covers behavior: it details the entire approval process (setApprovalForAll vs approve), explains that quotes expire, warns about price impact on-chain, and describes the affiliate fee mechanism. This is comprehensive with no contradictions.

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 long but well-organized into sections (purpose, workflow, execution flow, warning). Every sentence adds necessary information for a complex multi-step tool. However, it could be slightly more concise without losing clarity.

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?

Given 10 parameters, no output schema, and no annotations, the description covers all essential aspects: workflow prerequisites, execution steps, parameter relationships, safety warnings, and expected response fields (priceImpact). It is fully adequate for an agent to use correctly.

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

Parameters5/5

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

Schema coverage is 100%, but the description adds significant meaning beyond the schema: it explains that parameters like positionId, nftManager, dexName, liquidityKind come from list_user_lp_positions, provides specific guidance for 'percent' (use 99 for classic pools), and clarifies affiliateCode usage. This greatly enhances parameter understanding.

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?

The description explicitly states it 'builds a single-transaction zap to exit an LP position into ANY output token', clearly distinguishing it from sibling tools like 'zap_into_lp_position' (entry) and 'list_user_lp_positions' (listing). The verb 'exit' and resource 'LP position' are specific.

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

Usage Guidelines4/5

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

Provides a REQUIRED WORKFLOW with steps (first call list_user_lp_positions, then pass fields), and execution flow with approval details. It guides when to use this tool but does not explicitly state when not to use it or compare to alternatives beyond the workflow.

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

A4.4/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: pool analysis, health check, quotes (standard and clean), setup guide, chain/DEX info, LP position listing, pool search, and zap in/out. No two tools overlap in functionality.

Naming Consistency4/5

All tool names use snake_case, but the verb prefixes are not uniform: some use 'get_*', others use 'analyze_', 'check_', 'list_', 'search_', 'zap_'. While still clear, a more consistent prefix pattern would improve predictability.

Tool Count5/5

11 tools cover the full scope of a DeFi liquidity management server: discovery, analysis, quoting, entry/exit, and auxiliary info. No redundant tools, and the count is well within the optimal range.

Completeness5/5

The tool surface covers all essential operations for liquidity management: pool search and analysis, swap quotes, position listing, and single-transaction zap in/out. No critical gaps are evident.

Resources