Skip to main content
Glama

getTokenPools

Find liquidity pools containing a specific token on a blockchain network to identify where the token is traded, with options to filter, sort, and paginate results.

Instructions

Get liquidity pools containing a specific token on a network. Great for finding where a token is traded.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
networkYesNetwork ID from getNetworks (e.g., "ethereum", "solana")
tokenAddressYesToken address or identifier
pageNoPage number for pagination
limitNoNumber of items per page (max 100)
sortNoSort orderdesc
orderByNoField to order byvolume_usd
reorderNoIf true, reorders the pool so that the specified token becomes the primary token for all metrics
addressNoFilter pools that contain this additional token address

Implementation Reference

  • The core handler function for the 'getTokenPools' tool. It constructs the API endpoint for fetching liquidity pools containing the specified token on a given network, handles optional parameters like pagination, sorting, reordering, and additional address filtering, fetches the data using the fetchFromAPI helper, and formats the response.
    async ({ network, tokenAddress, page, limit, sort, orderBy, reorder, address }) => { let endpoint = `/networks/${network}/tokens/${tokenAddress}/pools?page=${page}&limit=${limit}&sort=${sort}&order_by=${orderBy}`; if (reorder !== undefined) { endpoint += `&reorder=${reorder}`; } if (address) { endpoint += `&address=${encodeURIComponent(address)}`; } const data = await fetchFromAPI(endpoint); return formatMcpResponse(data); }
  • Zod schema defining the input parameters for the 'getTokenPools' tool, including required network and tokenAddress, and optional pagination, sorting, and filtering params.
    { network: z.string().describe('Network ID from getNetworks (e.g., "ethereum", "solana")'), tokenAddress: z.string().describe('Token address or identifier'), page: z.number().optional().default(0).describe('Page number for pagination'), limit: z.number().optional().default(10).describe('Number of items per page (max 100)'), sort: z.enum(['asc', 'desc']).optional().default('desc').describe('Sort order'), orderBy: z.enum(['volume_usd', 'price_usd', 'transactions', 'last_price_change_usd_24h', 'created_at']).optional().default('volume_usd').describe('Field to order by'), reorder: z.boolean().optional().describe('If true, reorders the pool so that the specified token becomes the primary token for all metrics'), address: z.string().optional().describe('Filter pools that contain this additional token address') },
  • src/index.js:168-192 (registration)
    Registration of the 'getTokenPools' tool using McpServer.tool method, specifying name, description, input schema, and handler function.
    server.tool( 'getTokenPools', 'Get liquidity pools containing a specific token on a network. Great for finding where a token is traded.', { network: z.string().describe('Network ID from getNetworks (e.g., "ethereum", "solana")'), tokenAddress: z.string().describe('Token address or identifier'), page: z.number().optional().default(0).describe('Page number for pagination'), limit: z.number().optional().default(10).describe('Number of items per page (max 100)'), sort: z.enum(['asc', 'desc']).optional().default('desc').describe('Sort order'), orderBy: z.enum(['volume_usd', 'price_usd', 'transactions', 'last_price_change_usd_24h', 'created_at']).optional().default('volume_usd').describe('Field to order by'), reorder: z.boolean().optional().describe('If true, reorders the pool so that the specified token becomes the primary token for all metrics'), address: z.string().optional().describe('Filter pools that contain this additional token address') }, async ({ network, tokenAddress, page, limit, sort, orderBy, reorder, address }) => { let endpoint = `/networks/${network}/tokens/${tokenAddress}/pools?page=${page}&limit=${limit}&sort=${sort}&order_by=${orderBy}`; if (reorder !== undefined) { endpoint += `&reorder=${reorder}`; } if (address) { endpoint += `&address=${encodeURIComponent(address)}`; } const data = await fetchFromAPI(endpoint); return formatMcpResponse(data); } );
  • Helper function to make API requests to DexPaprika, handles errors like 410 (deprecated endpoint) and 429 (rate limit), used by getTokenPools handler.
    async function fetchFromAPI(endpoint) { try { const response = await fetch(`${API_BASE_URL}${endpoint}`); if (!response.ok) { if (response.status === 410) { throw new Error( 'This endpoint has been permanently removed. Please use network-specific endpoints instead. ' + 'For example, use /networks/{network}/pools instead of /pools. ' + 'Get available networks first using the getNetworks function.' ); } if (response.status === 429) { throw new Error( 'Rate limit exceeded. You have reached the maximum number of requests allowed for the free tier. ' + 'To increase your rate limits and access additional features, please consider upgrading to a paid plan at https://docs.dexpaprika.com/' ); } throw new Error(`API request failed with status ${response.status}`); } return await response.json(); } catch (error) { console.error(`Error fetching from API: ${error.message}`); throw error; } }
  • Helper function to format API response data into MCP-compatible content structure, used by getTokenPools and other tools.
    function formatMcpResponse(data) { return { content: [ { type: "text", text: JSON.stringify(data) } ] }; }

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/coinpaprika/dexpaprika-mcp'

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