getNetworkPools
Fetch top liquidity pools on a specified blockchain network using network ID, with options to sort by volume, price, or transactions, and paginate results for detailed DeFi analytics.
Instructions
PRIMARY POOL FUNCTION: Get top liquidity pools on a specific network. This is the MAIN way to get pool data - there is NO global pools function. Use this instead of any "getTopPools" or "getAllPools" concepts.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Number of items per page (max 100) | |
| network | Yes | Network ID from getNetworks (required) - e.g., "ethereum", "solana" | |
| orderBy | No | Field to order by | volume_usd |
| page | No | Page number for pagination | |
| sort | No | Sort order | desc |
Implementation Reference
- src/index.js:104-118 (registration)Registration of the getNetworkPools tool, including schema and inline handler function.server.tool( 'getNetworkPools', 'PRIMARY POOL FUNCTION: Get top liquidity pools on a specific network. This is the MAIN way to get pool data - there is NO global pools function. Use this instead of any "getTopPools" or "getAllPools" concepts.', { network: z.string().describe('Network ID from getNetworks (required) - e.g., "ethereum", "solana"'), 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') }, async ({ network, page, limit, sort, orderBy }) => { const data = await fetchFromAPI(`/networks/${network}/pools?page=${page}&limit=${limit}&sort=${sort}&order_by=${orderBy}`); return formatMcpResponse(data); } );
- src/index.js:114-117 (handler)The handler function for getNetworkPools that fetches pool data from the DexPaprika API endpoint `/networks/{network}/pools` with pagination and sorting parameters.async ({ network, page, limit, sort, orderBy }) => { const data = await fetchFromAPI(`/networks/${network}/pools?page=${page}&limit=${limit}&sort=${sort}&order_by=${orderBy}`); return formatMcpResponse(data); }
- src/index.js:107-113 (schema)Zod schema defining input parameters for the getNetworkPools tool: network (required), pagination, sorting.{ network: z.string().describe('Network ID from getNetworks (required) - e.g., "ethereum", "solana"'), 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') },
- src/index.js:10-34 (helper)Shared helper function fetchFromAPI used by getNetworkPools to make API requests to DexPaprika and handle errors.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; } }
- src/index.js:37-46 (helper)Shared helper function formatMcpResponse used by getNetworkPools to format the API response for MCP protocol.function formatMcpResponse(data) { return { content: [ { type: "text", text: JSON.stringify(data) } ] }; }