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
| Name | Required | Description | Default |
|---|---|---|---|
| network | Yes | Network ID (e.g., 'eth', 'bsc', 'polygon_pos') | |
| page | No | Page 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}`); } }
- src/toolService.js:166-178 (helper)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;
- src/index.js:253-268 (schema)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"], },
- src/constants.js:21-21 (helper)Constant definition for the tool name used across the codebase.GET_SUPPORTED_DEXES: "get_supported_dexes",