getNetworks
Retrieve all supported blockchain networks to identify available options before accessing network-specific cryptocurrency data and analytics.
Instructions
REQUIRED FIRST STEP: Get all supported blockchain networks. Always call this first to see available networks before using any network-specific functions. Returns network IDs like "ethereum", "solana", etc.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.js:72-80 (registration)Registers the getNetworks MCP tool with empty input schema {}, description, and inline handler function.server.tool( 'getNetworks', 'REQUIRED FIRST STEP: Get all supported blockchain networks. Always call this first to see available networks before using any network-specific functions. Returns network IDs like "ethereum", "solana", etc.', {}, async () => { const data = await fetchFromAPI('/networks'); return formatMcpResponse(data); } );
- src/index.js:76-79 (handler)Handler function that fetches network data from DexPaprika API endpoint '/networks' and formats it for MCP response.async () => { const data = await fetchFromAPI('/networks'); return formatMcpResponse(data); }
- src/index.js:75-75 (schema)Empty input schema (no parameters required) for getNetworks tool.{},
- src/index.js:10-34 (helper)Helper function to fetch data from DexPaprika API, handles errors including 410 (deprecated endpoints) and 429 (rate limits), called by getNetworks 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; } }
- src/index.js:37-46 (helper)Helper function to format API response data into MCP-compatible response structure, used by getNetworks handler.function formatMcpResponse(data) { return { content: [ { type: "text", text: JSON.stringify(data) } ] }; }