Skip to main content
Glama

detect_dex

Identify which decentralized exchange a Solana token trades on, returning DEX name, pool address, price, and liquidity data for trading analysis.

Instructions

Detect which DEX/AMM a Solana token trades on. Returns DEX name, pool address, token name/symbol, price, market cap, and liquidity. Supports PumpSwap, Raydium, Meteora, Orca, and more.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
mintYesToken mint address (base58)

Implementation Reference

  • The handler function for the 'detect_dex' tool. It calls the underlying 'detectDex' service and formats the result as a JSON string for the MCP tool response.
    export async function handleDetectDex(input) {
        try {
            const result = await detectDex(input.mint);
            if (!result.success) {
                return JSON.stringify({
                    success: false,
                    error: result.error || 'Token not found on any supported DEX',
                });
            }
            return JSON.stringify({
                success: true,
                mint: input.mint,
                dex: result.dex,
                amm: result.amm,
                poolAddress: result.poolAddress,
                token: {
                    name: result.tokenName,
                    symbol: result.tokenSymbol,
                    priceUsd: result.priceUsd,
                    marketCapUsd: result.marketCapUsd,
                    liquidityUsd: result.liquidityUsd,
                },
            }, null, 2);
        }
        catch (error) {
            return JSON.stringify({
                success: false,
                error: error instanceof Error ? error.message : String(error),
            });
        }
    }
  • The API service function that actually performs the network request to fetch DEX detection data for a given token mint.
    export async function detectDex(mint) {
        const data = await apiGet(`/api/trade/detect/${mint}`);
        return {
            success: data.success,
            amm: data.amm,
            dex: data.dex,
            poolAddress: data.poolAddress,
            tokenName: data.tokenName,
            tokenSymbol: data.tokenSymbol,
            priceUsd: data.priceUsd,
            marketCapUsd: data.marketCapUsd,
            liquidityUsd: data.liquidityUsd,
            error: data.error,
        };
    }
  • Zod schema defining the input requirements for the 'detect_dex' tool, validating that the provided 'mint' is a string of valid length for a Solana address.
    export const detectDexSchema = z.object({
        mint: z.string().min(32).max(44).describe('Token mint address (base58)'),
    });
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses the return data (DEX name, pool address, token details, price, market cap, liquidity) and supported DEXs, which is useful behavioral context. However, it doesn't mention error handling, rate limits, authentication needs, or whether the operation is read-only/destructive.

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?

Two sentences with zero waste: first states purpose and return values, second lists supported DEXs. Every element adds value, and it's front-loaded with the core functionality.

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

Completeness4/5

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

Given 1 parameter with full schema coverage, no annotations, and no output schema, the description is reasonably complete: it explains what the tool does, what it returns, and supported DEXs. However, for a tool returning financial data, it could better address accuracy, freshness, or limitations (e.g., 'and more' is vague).

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 the schema already documents the mint parameter fully. The description adds no additional parameter semantics beyond what the schema provides (e.g., no examples or constraints on mint format beyond base58). Baseline 3 is appropriate when schema does the heavy lifting.

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

Purpose5/5

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

The description clearly states the specific action ('detect which DEX/AMM a Solana token trades on') and resource ('Solana token'), distinguishing it from siblings like get_sol_price (price only), get_token_info (general token data), and scan_wallet (wallet analysis). It explicitly lists supported DEXs, making the scope unambiguous.

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

Usage Guidelines4/5

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

The description implies usage context (identifying trading venues for Solana tokens) but doesn't explicitly state when to use this tool versus alternatives like get_token_info. It mentions supported DEXs, which helps scope applicability, but lacks explicit exclusions or comparisons to sibling tools.

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

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/RefundYourSOL/refundyoursol-mcp'

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