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

A5/5.0
Behavior5/5

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

With no annotations, the description carries full behavioral disclosure. It reveals operational traits: handles LP burn, fee collection, and swaps in one transaction; requires approvals depending on position type; quotes expire; requires a private key; and mandates presenting priceImpact to the user for confirmation. It also warns about potential reverts with 100% for classic pools. This goes far beyond a simple functional statement.

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 long but well-structured with clear headings (REQUIRED WORKFLOW, EXECUTION FLOW) and numbered steps. Every sentence adds critical information, from the API mapping to the price impact warning. No fluff or repetition—each part earns its place.

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 the tool's complexity (10 parameters, no output schema), the description is remarkably complete. It covers prerequisites, step-by-step execution, approval variations, quote freshness, the price impact field, and a specific warning about classic pools. It leaves no major operational questions unanswered.

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?

Although schema coverage is 100%, the description adds significant value beyond the schema. It clarifies that positionId, nftManager, dexName, and liquidityKind come from list_user_lp_positions, explains the percent parameter's edge cases (99 vs 100 to avoid race conditions), and details how affiliateCode is forwarded. This extra context makes parameter usage unambiguous.

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 states a specific verb and resource: 'Builds a single-transaction zap to exit an LP position into ANY output token.' It clearly distinguishes from sibling tools like zap_into_lp_position (entering) and list_user_lp_positions (listing positions). It also mentions the API endpoint and the ability to withdraw into any token, which removes ambiguity.

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?

The description provides an explicit REQUIRED WORKFLOW: first call list_user_lp_positions, then pass the returned fields. It details the EXECUTION FLOW with approval steps, waiting for confirmation, fresh quotes, and sending the transaction. It also gives alternatives and exclusions (e.g., do NOT use approve(router, tokenId) for NFT positions, use 99% for classic pools). This fully guides when and how to use the tool.

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.5/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: health check, setup guide, chain/dex list, pool discovery, pool analysis, swap quoting (with per-use-case variant), LP position listing, and single-transaction LP entry/exit. No significant overlap.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern in snake_case (analyze_pool, get_swap_quote, list_user_lp_positions, etc.). Even 'zap_into_lp_position' and 'zap_out_of_lp_position' maintain the pattern with verbs 'zap_into' and 'zap_out_of'.

Tool Count5/5

11 tools is well-scoped for a DeFi liquidity management server covering health, discovery, quoting, and LP operations. Each tool earns its place without redundancy.

Completeness4/5

Covers core workflows: pool discovery, analysis, swap quotes, LP position management, and single-transaction zap in/out. Missing is a direct token approval tool, but instructions for approvals are embedded in relevant tools. Minor gap but highly functional.