Skip to main content
Glama
tamago-labs

Tapp Exchange MCP Server

by tamago-labs

tapp_get_swap_route

Retrieve the optimal swap route between two tokens on the Tapp Exchange MCP Server for efficient decentralized trading and liquidity management on the Aptos blockchain.

Instructions

Get the optimal route information between two tokens

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
token0YesThe address of the first token
token1YesThe address of the second token

Implementation Reference

  • MCP tool handler function that extracts token addresses from input, calls TappAgent.getSwapRoute, and returns the route in a standardized success response.
    handler: async (agent: TappAgent, input: Record<string, any>) => {
        const route = await agent.getSwapRoute(input.token0, input.token1);
        return {
            status: "success",
            route
        };
    },
  • Zod-based input schema validating token0 and token1 as strings with descriptions.
    schema: {
        token0: z.string().describe("The address of the first token"),
        token1: z.string().describe("The address of the second token")
    },
  • src/index.ts:20-52 (registration)
    Dynamic registration loop in MCP server creation that registers the tool by its name "tapp_get_swap_route", 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",
                        },
                    ],
                };
            }
        })
    }
  • Supporting method in TappAgent that delegates to the Tapp SDK's Swap.getRoute for obtaining the optimal swap route between two tokens.
    async getSwapRoute(token0: string, token1: string): Promise<any> {
        const route = await this.sdk.Swap.getRoute(token0, token1);
        return route;
    }
  • src/mcp/index.ts:32-32 (registration)
    Inclusion of the GetSwapRouteTool in the TappExchangeMcpTools object used for MCP server registration.
    "GetSwapRouteTool": GetSwapRouteTool,
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'optimal route information' but doesn't clarify if this is a read-only operation, what data it returns (e.g., paths, costs, slippage), or any constraints like rate limits or authentication needs. This leaves significant gaps in understanding the tool's behavior.

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 without any unnecessary words. It is front-loaded and wastes no space, 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 swap routing in DeFi and the lack of annotations and output schema, the description is incomplete. It doesn't explain what 'optimal route information' entails, how results are structured, or any prerequisites, which could lead to misuse or confusion by an AI agent in a real-world 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?

The input schema has 100% description coverage, clearly documenting both parameters as token addresses. The description adds no additional meaning beyond this, such as token format or validation rules, but since the schema is comprehensive, a baseline score of 3 is appropriate as it doesn't detract from the existing documentation.

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 with a specific verb ('Get') and resource ('optimal route information between two tokens'), making it easy to understand what it does. However, it doesn't explicitly differentiate from sibling tools like 'tapp_get_swap_estimate' or the various swap tools, which might have overlapping functionality for routing or estimation.

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. Given the sibling tools include multiple swap-related tools (e.g., tapp_get_swap_estimate, tapp_swap_amm), there is no indication of whether this is for planning vs. execution, or how it differs in context, leaving the agent to infer usage.

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