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)'),
    });

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