Skip to main content
Glama
tamago-labs

Tapp Exchange MCP Server

by tamago-labs

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'
            };
        }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. 'Execute a swap' implies a write/mutation operation, but it doesn't disclose critical behavioral traits such as transaction costs, slippage risks, authorization requirements, or irreversible effects. This is inadequate for a financial tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's front-loaded with the core action and resource, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a swap operation (financial transaction with risks), no annotations, and no output schema, the description is incomplete. It lacks details on execution behavior, error handling, or return values, which are crucial for safe tool invocation in this context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so parameters are well-documented in the schema. The description adds no additional meaning beyond implying a swap operation, which is already clear from the tool name. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Execute a swap') and the resource ('on a Stable pool'), which is specific and unambiguous. However, it doesn't differentiate from sibling tools like 'tapp_swap_amm' or 'tapp_swap_clmm' beyond specifying 'Stable pool', leaving some ambiguity about when to choose this specific swap tool over others.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With sibling tools like 'tapp_swap_amm', 'tapp_swap_clmm', and 'tapp_get_swap_estimate', there's no indication of context, prerequisites, or trade-offs, leaving the agent to infer usage based on names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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