tapp_add_amm_liquidity
Add liquidity to an AMM pool by specifying the pool ID and amounts of token A and token B. Facilitates enhanced liquidity provision on Tapp Exchange via the Aptos blockchain.
Instructions
Add liquidity to an existing AMM pool
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amountA | Yes | The amount of token A to add as liquidity | |
| amountB | Yes | The amount of token B to add as liquidity | |
| poolId | Yes | The ID of the AMM pool |
Implementation Reference
- src/mcp/tapp/liquidity-tools.ts:90-100 (handler)The handler function that executes the tapp_add_amm_liquidity tool logic by calling TappAgent.addAMMLiquidity with parsed input parameters.handler: async (agent: TappAgent, input: Record<string, any>) => { const result = await agent.addAMMLiquidity({ poolId: input.poolId, amountA: input.amountA, amountB: input.amountB }); return { status: "success", transaction: result }; },
- Zod schema defining the input parameters for the tapp_add_amm_liquidity tool: poolId, amountA, and amountB.schema: { poolId: z.string().describe("The ID of the AMM pool"), amountA: z.number().describe("The amount of token A to add as liquidity"), amountB: z.number().describe("The amount of token B to add as liquidity") },
- src/mcp/index.ts:42-45 (registration)Registration of the AddAMMLiquidityTool (tapp_add_amm_liquidity) in the main TappExchangeMcpTools export object.// Add Liquidity Tools "AddAMMLiquidityTool": AddAMMLiquidityTool, "AddCLMMLiquidityTool": AddCLMMLiquidityTool, "AddStableLiquidityTool": AddStableLiquidityTool,
- src/agent/index.ts:379-398 (handler)TappAgent.addAMMLiquidity method: generates transaction payload via Tapp SDK and submits it via Aptos client. Called by the tool handler.async addAMMLiquidity(params: AddAMMLiquidityParams): Promise<TransactionResponse> { try { const data = this.sdk.Position.addAMMLiquidity(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' }; } }
- src/mcp/tapp/liquidity-tools.ts:82-101 (registration)Complete McpTool object definition for tapp_add_amm_liquidity, including name, description, schema, and handler.export const AddAMMLiquidityTool: McpTool = { name: "tapp_add_amm_liquidity", description: "Add liquidity to an existing AMM pool", schema: { poolId: z.string().describe("The ID of the AMM pool"), amountA: z.number().describe("The amount of token A to add as liquidity"), amountB: z.number().describe("The amount of token B to add as liquidity") }, handler: async (agent: TappAgent, input: Record<string, any>) => { const result = await agent.addAMMLiquidity({ poolId: input.poolId, amountA: input.amountA, amountB: input.amountB }); return { status: "success", transaction: result }; }, };