getStats
Retrieve high-level statistics for the DexPaprika ecosystem, including total networks, DEXes, pools, and tokens available 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:254-257 (handler)Executes the tool logic by fetching stats data from the DexPaprika '/stats' API endpoint using the fetchFromAPI helper and formatting the response with formatMcpResponse for MCP protocol compliance.async () => { const data = await fetchFromAPI('/stats'); return formatMcpResponse(data); }
- src/index.js:253-253 (schema)Input schema definition for the getStats tool: empty object indicating no input parameters are required.{},
- src/index.js:250-258 (registration)MCP tool registration for 'getStats' using server.tool(), including tool name, description, input 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:10-34 (helper)Shared utility function fetchFromAPI used by the getStats handler to perform HTTP requests to the DexPaprika API with error handling for specific status codes.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 utility function formatMcpResponse used by the getStats handler to format the raw API data into the MCP protocol response structure.function formatMcpResponse(data) { return { content: [ { type: "text", text: JSON.stringify(data) } ] }; }