build_remove_liquidity
Remove liquidity from a trading pair on the Casper Network by building an unsigned transaction with specified percentage, slippage, and deadline parameters.
Instructions
Build an unsigned remove-liquidity transaction
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pair | Yes | Pair contract package hash | |
| percentage | Yes | Percentage of liquidity to remove (1-100) | |
| slippage_bps | No | Slippage in basis points (default 300) | |
| deadline_minutes | No | Deadline in minutes (default 20) | |
| sender_public_key | Yes | Sender hex public key |
Implementation Reference
- The handler function for the `build_remove_liquidity` MCP tool. It calls the `client.buildRemoveLiquidity` method and saves the resulting transaction to a file.
async (args) => { const bundle = await client.buildRemoveLiquidity({ pairContractPackageHash: args.pair, percentage: args.percentage, slippageBps: args.slippage_bps, deadlineMinutes: args.deadline_minutes, senderPublicKey: args.sender_public_key, }); const deployPath = await writeDeployFile(bundle.transactionJson); return { content: [{ type: 'text' as const, text: bundle.summary + `\n\nUnsigned transaction saved to: ${deployPath}` }] }; }, ); - packages/mcp/src/tools/liquidity.ts:59-80 (registration)Registration of the `build_remove_liquidity` tool, including its schema definitions.
server.tool( 'build_remove_liquidity', 'Build an unsigned remove-liquidity transaction', { pair: z.string().describe('Pair contract package hash'), percentage: z.number().min(1).max(100).describe('Percentage of liquidity to remove (1-100)'), slippage_bps: z.number().optional().describe('Slippage in basis points (default 300)'), deadline_minutes: z.number().optional().describe('Deadline in minutes (default 20)'), sender_public_key: z.string().describe('Sender hex public key'), }, async (args) => { const bundle = await client.buildRemoveLiquidity({ pairContractPackageHash: args.pair, percentage: args.percentage, slippageBps: args.slippage_bps, deadlineMinutes: args.deadline_minutes, senderPublicKey: args.sender_public_key, }); const deployPath = await writeDeployFile(bundle.transactionJson); return { content: [{ type: 'text' as const, text: bundle.summary + `\n\nUnsigned transaction saved to: ${deployPath}` }] }; }, );