Skip to main content
Glama

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
NameRequiredDescriptionDefault
pairYesPair contract package hash
percentageYesPercentage of liquidity to remove (1-100)
slippage_bpsNoSlippage in basis points (default 300)
deadline_minutesNoDeadline in minutes (default 20)
sender_public_keyYesSender 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}` }] };
      },
    );
  • 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}` }] };
      },
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/make-software/cspr-trade-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server