Skip to main content
Glama

getNetworks

Retrieve all supported blockchain networks to identify available options before using network-specific cryptocurrency data functions.

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function for the getNetworks tool. Fetches network data from the DexPaprika API endpoint '/networks' and formats it using formatMcpResponse.
    async () => {
      const data = await fetchFromAPI('/networks');
      return formatMcpResponse(data);
    }
  • Input schema for getNetworks tool: empty object indicating no input parameters are required.
    {},
  • src/index.js:72-80 (registration)
    Registration of the getNetworks tool using McpServer's tool() method, including name, description, schema, and 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);
      }
    );
  • Helper function that formats the raw API response data into the MCP protocol response format, used by getNetworks and other tools.
    function formatMcpResponse(data) {
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(data)
          }
        ]
      };
    }
  • Helper function to perform HTTP fetches to the DexPaprika API base URL, with error handling for rate limits and other issues, 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;
      }
    }

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