Skip to main content
Glama

DeFi Trading Agent MCP Server

by edkdev

get_supported_dexes

Retrieve a list of supported decentralized exchanges (DEXes) on a specified blockchain network to enable DeFi trading decisions. Supports pagination for efficient data access.

Instructions

Get list of supported DEXes on a specific network

Input Schema

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

Input Schema (JSON Schema)

{ "properties": { "network": { "description": "Network ID (e.g., 'eth', 'bsc', 'polygon_pos')", "type": "string" }, "page": { "description": "Page number for pagination (optional, default: 1)", "type": "integer" } }, "required": [ "network" ], "type": "object" }

Implementation Reference

  • Core handler implementation that fetches the list of supported DEXes for a given network from the CoinGecko API, handling pagination and errors.
    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}`); } }
  • ToolService wrapper method that validates input, delegates to CoinGeckoApiService, and formats the response with metadata.
    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`, }; }
  • src/index.js:1018-1020 (registration)
    MCP server dispatcher that routes calls to the get_supported_dexes tool to the ToolService method.
    case TOOL_NAMES.GET_SUPPORTED_DEXES: result = await toolService.getSupportedDexes(args.network, args.page); break;
  • Tool schema definition including input parameters (network required, page optional) registered in the MCP server tool list.
    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"], },
  • Constant definition for the tool name used across the codebase.
    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