Skip to main content
Glama
tamago-labs

Tapp Exchange MCP Server

by tamago-labs

tapp_get_swap_estimate

Calculate the estimated input or output amount for a token swap on Tapp Exchange, specifying pool, token pair, direction, and amount type.

Instructions

Estimate the amount received or needed for a swap on Tapp Exchange

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
a2bYesSwap direction - true for token at pair[0] to pair[1], false for pair[1] to pair[0]
amountYesThe amount for estimation (used as input or desired output depending on field)
fieldNoIndicates if amount is an 'input' or 'output' amount (defaults to 'input')
pairYesA tuple of token indexes to swap, e.g., [0, 1] means token at index 0 is being swapped for token at index 1
poolIdYesThe identifier of the pool

Implementation Reference

  • The MCP tool handler function that parses input and delegates to TappAgent.getEstimateSwapAmount, returning the estimate result.
    handler: async (agent: TappAgent, input: Record<string, any>) => {
        const estimate = await agent.getEstimateSwapAmount({
            amount: input.amount,
            poolId: input.poolId,
            pair: input.pair as [number, number],
            a2b: input.a2b,
            field: input.field || 'input'
        });
        return {
            status: "success",
            estimate
        };
    },
  • Zod-based input schema defining parameters: amount, poolId, pair, a2b, and optional field.
    schema: {
        amount: z.number().describe("The amount for estimation (used as input or desired output depending on field)"),
        poolId: z.string().describe("The identifier of the pool"),
        pair: z.array(z.number()).describe("A tuple of token indexes to swap, e.g., [0, 1] means token at index 0 is being swapped for token at index 1"),
        a2b: z.boolean().describe("Swap direction - true for token at pair[0] to pair[1], false for pair[1] to pair[0]"),
        field: z.enum(['input', 'output']).optional().describe("Indicates if amount is an 'input' or 'output' amount (defaults to 'input')")
    },
  • src/mcp/index.ts:31-31 (registration)
    The tool is registered in the TappExchangeMcpTools object by mapping the export name to the tool object, which is later iterated to register with MCP server.
    "GetSwapEstimateTool": GetSwapEstimateTool,
  • TappAgent helper method that calls the underlying SDK to compute the swap estimate.
    async getEstimateSwapAmount(params: {
        amount: number;
        poolId: string;
        pair: [number, number];
        a2b: boolean;
        field?: 'input' | 'output';
    }): Promise<SwapEstimate> {
        const result = await this.sdk.Swap.getEstSwapAmount(params);
        return result;
    }
  • src/index.ts:20-52 (registration)
    The dynamic registration loop in the MCP server creation that registers the tool using its internal name, description, schema, and wrapped handler.
    for (const [_key, tool] of Object.entries(TappExchangeMcpTools)) {
        server.tool(tool.name, tool.description, tool.schema, async (params: any): Promise<any> => {
            try {
                // Execute the handler with the params directly
                const result = await tool.handler(agent, params);
    
                // Format the result as MCP tool response
                return {
                    content: [
                        {
                            type: "text",
                            text: JSON.stringify(result, null, 2),
                        },
                    ],
                };
            } catch (error) {
                console.error("error", error);
                // Handle errors in MCP format
                return {
                    isError: true,
                    content: [
                        {
                            type: "text",
                            text:
                                error instanceof Error
                                    ? error.message
                                    : "Unknown error occurred",
                        },
                    ],
                };
            }
        })
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is an estimation tool but doesn't clarify whether it's read-only, whether it requires authentication, rate limits, or what the estimation is based on (current pool state, slippage assumptions, etc.). For a financial estimation tool with zero annotation coverage, this is insufficient behavioral context.

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 directly states the tool's purpose. It's appropriately sized for an estimation tool and wastes no words. The structure is front-loaded with the core functionality immediately clear.

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

Completeness3/5

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

For a 5-parameter estimation tool with no annotations and no output schema, the description is minimally adequate. It identifies the domain (Tapp Exchange swaps) and estimation purpose, but doesn't explain what the estimation returns, error conditions, or how it relates to actual swap execution. Given the complexity of DeFi swaps and rich sibling toolset, more context would be helpful.

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?

The description mentions 'amount received or needed' which hints at the bidirectional nature of estimation, but doesn't explicitly connect to the 'field' parameter's input/output options. With 100% schema description coverage, the schema already documents all 5 parameters thoroughly. The description adds minimal value beyond what's in the schema, meeting the baseline for high coverage.

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 tool's purpose: estimating swap amounts on Tapp Exchange. It specifies the verb 'estimate' and resource 'swap', but doesn't differentiate from sibling tools like tapp_get_swap_route or the various swap execution tools (tapp_swap_amm, etc.). The description is specific about what's being estimated but lacks sibling distinction.

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 multiple sibling tools including tapp_get_swap_route and various swap execution tools, there's no indication whether this is for preliminary estimation before executing a swap, or how it differs from route calculation. No context about prerequisites or when-not-to-use is provided.

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