Skip to main content
Glama

tapp_swap_stable

Facilitate token swaps within Stable pools on Tapp Exchange by specifying pool address, input/output token indices, amount, and minimum output. Optimizes trading operations on Aptos blockchain.

Instructions

Execute a swap on a Stable pool

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
amountInYesThe input token amount for the swap
minAmountOutYesThe minimum amount of output tokens
poolIdYesThe address of the Stable pool
tokenInYesThe index of the token to swap from
tokenOutYesThe index of the token to swap to

Implementation Reference

  • The handler function that executes the tapp_swap_stable tool logic by calling TappAgent.swapStable with input parameters and returning the transaction result.
    handler: async (agent: TappAgent, input: Record<string, any>) => { const result = await agent.swapStable({ poolId: input.poolId, tokenIn: input.tokenIn, tokenOut: input.tokenOut, amountIn: input.amountIn, minAmountOut: input.minAmountOut }); return { status: "success", transaction: result }; },
  • Input schema using Zod for validating parameters: poolId, tokenIn, tokenOut, amountIn, minAmountOut.
    schema: { poolId: z.string().describe("The address of the Stable pool"), tokenIn: z.number().describe("The index of the token to swap from"), tokenOut: z.number().describe("The index of the token to swap to"), amountIn: z.number().describe("The input token amount for the swap"), minAmountOut: z.number().describe("The minimum amount of output tokens") },
  • src/mcp/index.ts:30-36 (registration)
    Registration of SwapStableTool (tapp_swap_stable) in the TappExchangeMcpTools object used for MCP tool server.
    // Swap Tools "GetSwapEstimateTool": GetSwapEstimateTool, "GetSwapRouteTool": GetSwapRouteTool, "SwapAMMTool": SwapAMMTool, "SwapCLMMTool": SwapCLMMTool, "SwapStableTool": SwapStableTool,
  • Supporting method in TappAgent that generates the stable swap transaction payload using the Tapp SDK and submits it via Aptos SDK.
    async swapStable(params: SwapStableParams): Promise<TransactionResponse> { try { const data = this.sdk.Swap.swapStableTransactionPayload(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' }; } }

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/tamago-labs/tapp-exchange-mcp'

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