Skip to main content
Glama
tamago-labs

Tapp Exchange MCP Server

by tamago-labs

tapp_swap_clmm

Perform a token swap on a Concentrated Liquidity Market Maker (CLMM) pool using specified input amount, minimum output, direction, and target price. Execute trades efficiently within the Tapp Exchange ecosystem.

Instructions

Execute a swap on a CLMM (Concentrated Liquidity Market Maker) pool

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
a2bYesDirection of the swap; true for token A to B, false for B to A
amountInYesThe input token amount for the swap
fixedAmountInNoIndicates whether amountIn is fixed (defaults to true)
minAmountOutYesThe minimum acceptable output amount
poolIdYesThe address of the CLMM pool
targetSqrtPriceYesThe target square root price

Implementation Reference

  • The main handler function for the "tapp_swap_clmm" tool. It validates inputs via schema and delegates to TappAgent.swapCLMM to execute the CLMM swap transaction.
        handler: async (agent: TappAgent, input: Record<string, any>) => {
            const result = await agent.swapCLMM({
                poolId: input.poolId,
                amountIn: input.amountIn,
                minAmountOut: input.minAmountOut,
                a2b: input.a2b,
                fixedAmountIn: input.fixedAmountIn ?? true,
                targetSqrtPrice: input.targetSqrtPrice
            });
            return {
                status: "success",
                transaction: result
            };
        },
    };
  • Zod schema defining the input parameters and validation for the tapp_swap_clmm tool.
    schema: {
        poolId: z.string().describe("The address of the CLMM pool"),
        amountIn: z.number().describe("The input token amount for the swap"),
        minAmountOut: z.number().describe("The minimum acceptable output amount"),
        a2b: z.boolean().describe("Direction of the swap; true for token A to B, false for B to A"),
        fixedAmountIn: z.boolean().optional().describe("Indicates whether amountIn is fixed (defaults to true)"),
        targetSqrtPrice: z.number().describe("The target square root price")
    },
  • src/mcp/index.ts:34-34 (registration)
    Registration of the SwapCLMMTool (named tapp_swap_clmm) in the central TappExchangeMcpTools export object used by the MCP server.
    "SwapCLMMTool": SwapCLMMTool,
  • Helper method in TappAgent class that implements the core swapCLMM logic by generating transaction payload from the Tapp SDK and submitting it via Aptos client.
    async swapCLMM(params: SwapCLMMParams): Promise<TransactionResponse> {
        try {
            const data = this.sdk.Swap.swapCLMMTransactionPayload(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?

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It states the action ('Execute a swap') which implies a write operation, but doesn't disclose critical traits like transaction costs, slippage risks, authorization requirements, or what happens on failure. For a financial tool with potential irreversible effects, this is inadequate.

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 that immediately conveys the core function without any wasted words. It's perfectly front-loaded and appropriately sized for the tool's complexity.

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 financial swap operation with no annotations and no output schema, the description is insufficient. It doesn't explain what the tool returns, error conditions, or important behavioral context like gas costs or confirmation requirements. The 100% schema coverage helps with parameters but doesn't compensate for missing operational 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%, providing clear documentation for all 6 parameters. The description adds no additional parameter semantics beyond what's in the schema, so it meets the baseline of 3 where the schema does the heavy lifting without compensating for any gaps.

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 target resource ('on a CLMM pool'), making the purpose immediately understandable. It distinguishes from sibling tools like 'tapp_swap_amm' and 'tapp_swap_stable' by specifying CLMM, but doesn't explicitly differentiate beyond the pool type.

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?

No guidance is provided on when to use this tool versus alternatives. While the description specifies CLMM, it doesn't mention when to choose CLMM over AMM or stable swaps, nor does it reference related tools like 'tapp_get_swap_estimate' for planning or 'tapp_get_pool_info' for pool details.

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