Skip to main content
Glama

getNetworkDexes

Retrieve available decentralized exchanges (DEXes) for a specific blockchain network to analyze trading platforms and liquidity sources.

Instructions

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

Input Schema

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

Implementation Reference

  • Handler function that fetches DEXes data from DexPaprika API for the specified network with optional pagination and formats the response for MCP.
    async ({ network, page, limit }) => { const data = await fetchFromAPI(`/networks/${network}/dexes?page=${page}&limit=${limit}`); return formatMcpResponse(data); }
  • Zod schema defining input parameters: network (required string), page and limit (optional numbers with defaults).
    { 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)
    Complete registration of the getNetworkDexes tool using McpServer.tool method, including name, description, input schema, and 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 format API response data into MCP-standard content structure.
    function formatMcpResponse(data) { return { content: [ { type: "text", text: JSON.stringify(data) } ] }; }
  • Core helper function used by getNetworkDexes handler to make HTTP requests to DexPaprika API, handle errors including rate limits and deprecated endpoints.
    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; } }

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