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 optio...
This record as markdown: /tools/defire-business-swapwizard-mcp/zap-out-of-lp-position.md
What zap_out_of_lp_position does on Swapwizard
AI agents use zap_out_of_lp_position to commit financial operations through Swapwizard, usually the final step of a payment, billing, or trading workflow. A call moves real money.
| Parameter | Type | Required | Description |
|---|---|---|---|
poolId | string | — | Pool identifier from search_liquidity_pools — pass if available. |
sender | string | Yes | Wallet address of the position owner. |
chainId | integer | Yes | EVM chain ID |
dexName | string | — | DEX project name from list_user_lp_positions (e.g. 'Uniswap V3', 'PancakeSwap V3', 'curve-dex'). |
percent | integer | — | Percentage 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 r |
nftManager | string | — | NFT position manager contract address from list_user_lp_positions. Required for CL positions (Uniswap V3/V4, PancakeSwap V3/Infinity CL, SushiSwap V3, Algebra). |
positionId | string | Yes | Position identifier from list_user_lp_positions. For CL positions: NFT token ID. For classic pools: LP token contract address. |
withdrawals | array | Yes | Tokens to receive after removal |
affiliateCode | string | — | Optional affiliate wallet address registered on-chain with SwapWizard — forwarded to the API so the affiliate fee for this operation is paid to that address. Om |
liquidityKind | string | — | Liquidity kind from list_user_lp_positions (e.g. UNIV3, UNIV4, ALGEBRA, SLIPSTREAM, PCS_INF_CL, CURVE, UNIV2, SOLIDLY). |
Parameters from the server's own tool schema.
Why zap_out_of_lp_position is rated Critical
This tool executes on-chain DeFi transactions that burn LP positions, collect fees, and perform token swaps — all of which move financial assets. Misuse could result in irreversible loss of user funds across 5 EVM chains, making it a Financial/critical risk tool.
From the tool's definition 'zap to exit an LP position', 'LP burn, fee collection, and intermediate swaps in a single transaction', 'POST /removeliquidity/quote', 'DeFi execution layer for AI agents - swap, zap in/out of LP'
Risk signalsHandles credentials or secrets (withdrawals[].token) · High parameter count (11 properties)
Attacks that exploit this kind of access
The rule that runs zap_out_of_lp_position safely
PolicyLayer is an MCP gateway: it sits between your AI agents and Swapwizard, and checks every tool call against a rule you set before the call runs. Nothing changes on the server itself. For zap_out_of_lp_position, this is the rule to start with:
Any call to zap_out_of_lp_position is blocked until a human approves it. The rest of the server keeps working.
The button opens the PolicyLayer dashboard: create your workspace, connect Swapwizard, apply this rule, and every zap_out_of_lp_position call is checked against it from then on.
Questions about 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. It is categorised as a Financial tool in the Swapwizard MCP Server, which means it involves financial transactions. Block by default and require explicit approval.
zap_out_of_lp_position accepts 10 parameters: poolId, sender, chainId, dexName, percent, nftManager, positionId, withdrawals, affiliateCode, liquidityKind. Required: sender, chainId, positionId, withdrawals. The full parameter table on this page comes from the server's own tool schema.
Register the Swapwizard MCP server in PolicyLayer and add a rule for zap_out_of_lp_position: allow, deny, rate-limit, or require approval. Point your MCP client at the PolicyLayer proxy URL and the rule is enforced on every call, before it reaches Swapwizard. Nothing to install.
zap_out_of_lp_position is a Financial tool with critical risk. Critical-risk tools should be blocked by default and only enabled with explicit human approval.
Yes. Add a rate_limit block to the zap_out_of_lp_position rule in your PolicyLayer policy. For example, setting max: 10 and window: 60 limits the tool to 10 calls per minute. Rate limits are tracked per agent session and reset automatically.
Set action: deny in the PolicyLayer policy for zap_out_of_lp_position. The AI agent will receive a policy violation error and cannot call the tool. You can also include a reason field to explain why the tool is blocked.
zap_out_of_lp_position is provided by the Swapwizard MCP server (@swapwizard/mcp-server). PolicyLayer sits as a proxy in front of this server to enforce policies before tool calls reach the server.
More on Swapwizard, and thousands of servers like it.
Across the catalogue