Skip to main content
Glama

getStats

Retrieve comprehensive 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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.js:250-258 (registration)
    Registration of the 'getStats' MCP tool using server.tool(). Defines empty input schema (no parameters), description, and inline 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);
      }
    );
  • Handler function for the getStats tool. Fetches stats data from the DexPaprika '/stats' API endpoint and formats it for MCP response.
    async () => {
      const data = await fetchFromAPI('/stats');
      return formatMcpResponse(data);
    }
  • Shared helper function used by getStats (and other tools) to make API requests to DexPaprika, with custom error handling for deprecated endpoints (410) and rate limits (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;
      }
    }
  • Shared helper function used by getStats (and other tools) to format raw API data into the standard MCP response format with JSON string in text content.
    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