Skip to main content
Glama
edkdev

DeFi Trading Agent MCP Server

by edkdev

get_coingecko_networks

Retrieve supported blockchain networks from CoinGecko/GeckoTerminal for crypto trading analysis and portfolio management across multiple chains.

Instructions

Get list of supported networks on CoinGecko/GeckoTerminal

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoPage number for pagination (optional, default: 1)

Implementation Reference

  • Main handler function that executes the tool logic by calling the CoinGecko API service's getNetworks method and wrapping the response with standardized message, data, and summary.
    async getCoinGeckoNetworks(page = 1) {
      const result = await this.coinGeckoApi.getNetworks(page);
    
      return {
        message: "CoinGecko networks retrieved successfully",
        data: result,
        summary: `Found ${result.data?.length || 0} networks on page ${page}`,
      };
    }
  • MCP tool schema defining the input parameters (page optional integer) and description for get_coingecko_networks.
      name: TOOL_NAMES.GET_COINGECKO_NETWORKS,
      description:
        "Get list of supported networks on CoinGecko/GeckoTerminal",
      inputSchema: {
        type: "object",
        properties: {
          page: {
            type: "integer",
            description: "Page number for pagination (optional, default: 1)",
          },
        },
        required: [],
      },
    },
  • src/index.js:1014-1016 (registration)
    MCP server request handler switch case that registers and dispatches calls to the tool handler.
    case TOOL_NAMES.GET_COINGECKO_NETWORKS:
      result = await toolService.getCoinGeckoNetworks(args.page);
      break;
  • Supporting utility in CoinGeckoApiService that makes the actual HTTP request to the CoinGecko /onchain/networks endpoint with pagination.
    async getNetworks(page = 1) {
      try {
        const queryParams = new URLSearchParams();
        if (page) queryParams.append('page', page);
    
        const url = `${this.baseUrl}/networks${queryParams.toString() ? '?' + queryParams.toString() : ''}`;
        
        const response = await fetch(url, {
          headers: {
            'x-cg-demo-api-key': this.apiKey
          }
        });
        
        if (!response.ok) {
          throw new Error(`HTTP ${response.status}: ${response.statusText}`);
        }
        
        return await response.json();
      } catch (error) {
        throw new Error(`Failed to get networks: ${error.message}`);
      }
    }
  • Constant defining the tool name string used throughout the codebase.
    GET_COINGECKO_NETWORKS: "get_coingecko_networks",

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/edkdev/defi-trading-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server