Skip to main content
Glama

getNetworkDexes

Retrieve available decentralized exchanges (DEXes) for a specific blockchain network using network IDs obtained from getNetworks, with pagination support for large datasets.

Instructions

Get available DEXes on a specific network. First call getNetworks to see valid network IDs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoNumber of items per page
networkYesNetwork ID from getNetworks (e.g., "ethereum", "solana")
pageNoPage number for pagination

Implementation Reference

  • Handler function that fetches DEXes data from the DexPaprika API endpoint for the given network with optional pagination and returns the formatted MCP response.
    async ({ network, page, limit }) => { const data = await fetchFromAPI(`/networks/${network}/dexes?page=${page}&limit=${limit}`); return formatMcpResponse(data); }
  • Zod schema defining the input parameters for the getNetworkDexes tool: network (required string), page and limit (optional numbers).
    { network: z.string().describe('Network ID from getNetworks (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') },
  • src/index.js:83-95 (registration)
    MCP server.tool registration for 'getNetworkDexes', including description, input schema, and inline handler function.
    server.tool( 'getNetworkDexes', 'Get available DEXes on a specific network. First call getNetworks to see valid network IDs.', { network: z.string().describe('Network ID from getNetworks (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') }, async ({ network, page, limit }) => { const data = await fetchFromAPI(`/networks/${network}/dexes?page=${page}&limit=${limit}`); return formatMcpResponse(data); } );
  • Helper function used by getNetworkDexes (and other tools) to make API requests to DexPaprika, handle specific error codes like 410 and 429.
    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 used by getNetworkDexes (and other tools) to format the API response into MCP-compatible content structure.
    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/infinity-smithpl/dexpaprika-mcp'

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