# 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.

Agent View of the PolicyLayer registry record for `zap_out_of_lp_position`. HTML page: https://policylayer.com/tools/defire-business-swapwizard-mcp/zap-out-of-lp-position

## Facts

- Tool: `zap_out_of_lp_position`
- Server: Swapwizard (`@swapwizard/mcp-server`) — https://policylayer.com/tools/defire-business-swapwizard-mcp.md
- Install: `npx -y @swapwizard/mcp-server`
- Homepage: https://github.com/DeFiRe-business/swapwizard-mcp
- Risk category: Financial (Critical risk)
- Registry record: grade D, identity unverified
- Server auth posture: open
- Server rate-limited: no
- Parameters: 10 (4 required)
- Recommended policy verdict: Approval-gated

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `poolId` | string | no | 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 | no | DEX project name from list_user_lp_positions (e.g. 'Uniswap V3', 'PancakeSwap V3', 'curve-dex'). |
| `percent` | integer | no | 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 | no | 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 | no | 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 | no | 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.

## Example call (MCP tools/call, JSON-RPC 2.0)

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "zap_out_of_lp_position",
    "arguments": {
      "sender": "<sender>",
      "chainId": 0,
      "positionId": "<positionId>",
      "withdrawals": []
    }
  }
}
```

## 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 own 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 signals: Handles credentials or secrets (withdrawals[].token) · High parameter count (11 properties)

## Use case

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.

## Recommended policy (PolicyLayer)

Verdict: **Approval-gated**. Enforced by the PolicyLayer MCP gateway (https://policylayer.com/mcp-gateway) before a call reaches Swapwizard:

```json
{
  "version": "1",
  "default": "deny",
  "tools": {
    "zap_out_of_lp_position": {
      "deny_if": [
        {
          "conditions": [],
          "on_deny": "Requires human approval."
        }
      ]
    }
  }
}
```

## Other tools on Swapwizard (10)

- `get_clean_quote` — Financial — https://policylayer.com/tools/defire-business-swapwizard-mcp/get-clean-quote.md
- `zap_into_lp_position` — Financial — https://policylayer.com/tools/defire-business-swapwizard-mcp/zap-into-lp-position.md
- `analyze_pool` — Read — https://policylayer.com/tools/defire-business-swapwizard-mcp/analyze-pool.md
- `check_api_health` — Read — https://policylayer.com/tools/defire-business-swapwizard-mcp/check-api-health.md
- `get_setup_guide` — Read — https://policylayer.com/tools/defire-business-swapwizard-mcp/get-setup-guide.md
- `get_supported_chains` — Read — https://policylayer.com/tools/defire-business-swapwizard-mcp/get-supported-chains.md
- `get_supported_dexes` — Read — https://policylayer.com/tools/defire-business-swapwizard-mcp/get-supported-dexes.md
- `get_swap_quote` — Read — https://policylayer.com/tools/defire-business-swapwizard-mcp/get-swap-quote.md
- `list_user_lp_positions` — Read — https://policylayer.com/tools/defire-business-swapwizard-mcp/list-user-lp-positions.md
- `search_liquidity_pools` — Read — https://policylayer.com/tools/defire-business-swapwizard-mcp/search-liquidity-pools.md

## For agents

This record is a snapshot. Live verdicts and the full registry:

- Check every server in your MCP config at once: `npx -y policylayer stack`
- Vet a server before you add it: install the mcp-precheck skill — `npx skills add https://policylayer.com` (skill text: https://policylayer.com/skill.md)
- Query the registry over MCP: endpoint `https://api.policylayer.com/mcp` — tools `check_mcp_server`, `check_mcp_stack`, `check_tool`, `search_registry`, `get_change_events`

---

Source: the PolicyLayer MCP registry — one continuously verified record per MCP server. Full record: https://policylayer.com/registry?q=defire-business-swapwizard-mcp · API: https://policylayer.com/registry/api · Policy library: https://policylayer.com/policies/defire-business-swapwizard-mcp
