tapp_create_amm_pool_and_add_liquidity
Create an Automated Market Maker (AMM) pool and provide initial liquidity by specifying token addresses, fee structure, and token amounts for decentralized trading on Tapp Exchange.
Instructions
Create an AMM 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 | |
| tokenAddress | Yes | An array of token addresses |
Implementation Reference
- src/mcp/tapp/liquidity-tools.ts:14-24 (handler)The MCP tool handler function that validates input, calls the TappAgent method, and returns the transaction result.handler: async (agent: TappAgent, input: Record<string, any>) => { const result = await agent.createAMMPoolAndAddLiquidity({ tokenAddress: input.tokenAddress, fee: input.fee, amounts: input.amounts }); return { status: "success", transaction: result }; },
- src/mcp/tapp/liquidity-tools.ts:9-13 (schema)Zod schema defining the input parameters for the tool: token addresses, fee, and initial amounts.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") },
- src/mcp/index.ts:38-38 (registration)The tool is registered in the TappExchangeMcpTools object, imported from liquidity-tools."CreateAMMPoolAndAddLiquidityTool": CreateAMMPoolAndAddLiquidityTool,
- src/agent/index.ts:316-335 (helper)TappAgent method that generates the transaction payload using the Tapp SDK and submits it via Aptos client.async createAMMPoolAndAddLiquidity(params: CreateAMMPoolAndAddLiquidityParams): Promise<TransactionResponse> { try { const data = this.sdk.Position.createAMMPoolAndAddLiquidity(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' }; } }