Skip to main content
Glama
edkdev

DeFi Trading Agent MCP Server

by edkdev

get_supported_dexes

Retrieve supported decentralized exchanges (DEXes) for a specific blockchain network to enable trading operations and liquidity analysis.

Instructions

Get list of supported DEXes on a specific network

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
networkYesNetwork ID (e.g., 'eth', 'bsc', 'polygon_pos')
pageNoPage number for pagination (optional, default: 1)

Implementation Reference

  • Main execution logic for the get_supported_dexes tool: validates network parameter, calls CoinGecko API service, and formats response.
    async getSupportedDexes(network, page = 1) {
      if (!network) {
        throw new Error("network is required");
      }
    
      const result = await this.coinGeckoApi.getSupportedDexes(network, page);
    
      return {
        message: `Supported DEXes for ${network} retrieved successfully`,
        data: result,
        summary: `Found ${result.data?.length || 0} DEXes on ${network} network`,
      };
    }
  • Input schema defining parameters: network (required string), page (optional integer). Used in MCP tool registration.
      name: TOOL_NAMES.GET_SUPPORTED_DEXES,
      description: "Get list of supported DEXes on a specific network",
      inputSchema: {
        type: "object",
        properties: {
          network: {
            type: "string",
            description: "Network ID (e.g., 'eth', 'bsc', 'polygon_pos')",
          },
          page: {
            type: "integer",
            description: "Page number for pagination (optional, default: 1)",
          },
        },
        required: ["network"],
      },
    },
  • src/index.js:1018-1020 (registration)
    Switch case in tool request handler that dispatches to toolService.getSupportedDexes with parsed arguments.
    case TOOL_NAMES.GET_SUPPORTED_DEXES:
      result = await toolService.getSupportedDexes(args.network, args.page);
      break;
  • Core API call to CoinGecko /networks/{network}/dexes endpoint to fetch supported DEXes list.
    async getSupportedDexes(network, page = 1) {
      try {
        const queryParams = new URLSearchParams();
        if (page) queryParams.append('page', page);
    
        const url = `${this.baseUrl}/networks/${network}/dexes${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 supported DEXes: ${error.message}`);
      }
    }
  • src/constants.js:21-21 (registration)
    Constant definition for the tool name used in registration and dispatch.
    GET_SUPPORTED_DEXES: "get_supported_dexes",

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