tapp_create_clmm_pool_and_add_liquidity
Create a CLMM pool on Tapp Exchange, define trading fees, and add initial liquidity with specified token amounts, price range, and initial price.
Instructions
Create a CLMM pool and add initial liquidity
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amounts | Yes | The initial token amounts | |
| fee | Yes | The fee traders will pay to use your pool's liquidity | |
| initialPrice | Yes | Starting price for liquidity | |
| isMaxAmountB | Yes | Whether the second token amount (amountB) is flexible based on slippage | |
| maxPrice | Yes | The upper bound price of the liquidity range | |
| minPrice | Yes | The lower bound price of the liquidity range | |
| tokenAddress | Yes | An array of token addresses |
Implementation Reference
- src/mcp/tapp/liquidity-tools.ts:27-54 (registration)Primary definition and registration of the McpTool named 'tapp_create_clmm_pool_and_add_liquidity' including schema and inline handlerexport const CreateCLMMPoolAndAddLiquidityTool: McpTool = { name: "tapp_create_clmm_pool_and_add_liquidity", description: "Create a CLMM pool and add initial liquidity", schema: { tokenAddress: z.array(z.string()).describe("An array of token addresses"), fee: z.number().describe("The fee traders will pay to use your pool's liquidity"), amounts: z.array(z.number()).describe("The initial token amounts"), initialPrice: z.number().describe("Starting price for liquidity"), minPrice: z.number().describe("The lower bound price of the liquidity range"), maxPrice: z.number().describe("The upper bound price of the liquidity range"), isMaxAmountB: z.boolean().describe("Whether the second token amount (amountB) is flexible based on slippage") }, handler: async (agent: TappAgent, input: Record<string, any>) => { const result = await agent.createCLMMPoolAndAddLiquidity({ tokenAddress: input.tokenAddress, fee: input.fee, amounts: input.amounts, initialPrice: input.initialPrice, minPrice: input.minPrice, maxPrice: input.maxPrice, isMaxAmountB: input.isMaxAmountB }); return { status: "success", transaction: result }; }, };
- src/agent/index.ts:337-356 (handler)Core handler logic in TappAgent that creates the CLMM pool and adds liquidity by calling the Tapp SDK and submitting the transactionasync createCLMMPoolAndAddLiquidity(params: CreateCLMMPoolAndAddLiquidityParams): Promise<TransactionResponse> { try { const data = this.sdk.Position.createCLMMPoolAndAddLiquidity(params); const response = await this.aptos.transaction.submit.simple({ sender: this.account.accountAddress, data: data } as any); return { hash: response.hash, success: true }; } catch (error) { return { hash: '', success: false, error: error instanceof Error ? error.message : 'Unknown error' }; } }
- Zod input schema for the tool parametersschema: { tokenAddress: z.array(z.string()).describe("An array of token addresses"), fee: z.number().describe("The fee traders will pay to use your pool's liquidity"), amounts: z.array(z.number()).describe("The initial token amounts"), initialPrice: z.number().describe("Starting price for liquidity"), minPrice: z.number().describe("The lower bound price of the liquidity range"), maxPrice: z.number().describe("The upper bound price of the liquidity range"), isMaxAmountB: z.boolean().describe("Whether the second token amount (amountB) is flexible based on slippage") },
- src/mcp/index.ts:39-39 (registration)Final registration of the tool in the main TappExchangeMcpTools export object"CreateCLMMPoolAndAddLiquidityTool": CreateCLMMPoolAndAddLiquidityTool,
- src/mcp/tapp/liquidity-tools.ts:39-53 (handler)MCP tool handler that extracts input and calls the TappAgent methodhandler: async (agent: TappAgent, input: Record<string, any>) => { const result = await agent.createCLMMPoolAndAddLiquidity({ tokenAddress: input.tokenAddress, fee: input.fee, amounts: input.amounts, initialPrice: input.initialPrice, minPrice: input.minPrice, maxPrice: input.maxPrice, isMaxAmountB: input.isMaxAmountB }); return { status: "success", transaction: result }; },