getStats
Retrieve essential statistics for the DexPaprika ecosystem, including total networks, DEXes, pools, and tokens, to analyze decentralized exchange data across multiple blockchains.
Instructions
Get high-level statistics about the DexPaprika ecosystem: total networks, DEXes, pools, and tokens available.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.js:260-263 (handler)Handler function for the getStats tool. Fetches high-level statistics from the DexPaprika API endpoint '/stats' and formats the response using formatMcpResponse.async () => { const data = await fetchFromAPI('/stats'); return formatMcpResponse(data); }
- src/index.js:259-259 (schema)Input schema for getStats tool: empty object indicating no input parameters required.{},
- src/index.js:256-264 (registration)MCP server tool registration for 'getStats', including name, description, schema, and handler function.server.tool( 'getStats', 'Get high-level statistics about the DexPaprika ecosystem: total networks, DEXes, pools, and tokens available.', {}, async () => { const data = await fetchFromAPI('/stats'); return formatMcpResponse(data); } );
- src/index.js:37-46 (helper)Helper utility to format raw API data into MCP response format with JSON stringified content.function formatMcpResponse(data) { return { content: [ { type: "text", text: JSON.stringify(data) } ] }; }
- src/index.js:10-34 (helper)Helper function to make API requests to DexPaprika, handles errors like 410 (deprecated endpoints) and 429 (rate limits).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; } }