Skip to main content
Glama
edkdev

DeFi Trading Agent MCP Server

by edkdev

get_trending_pools

Retrieve trending liquidity pools from GeckoTerminal across multiple networks to identify trading opportunities in DeFi markets.

Instructions

Get trending pools across all networks on GeckoTerminal

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
includeNoAttributes to include: 'base_token', 'quote_token', 'dex', 'network' (comma-separated)
pageNoPage number for pagination (optional, default: 1)
durationNoDuration for trending: '5m', '1h', '6h', '24h' (optional, default: '24h')

Implementation Reference

  • The primary handler function for the 'get_trending_pools' tool. It calls the CoinGecko API service to fetch trending pools data across all networks and formats the response with a message, data, summary, and duration.
    async getTrendingPools(options = {}) { const result = await this.coinGeckoApi.getTrendingPools(options); return { message: "Trending pools retrieved successfully", data: result, summary: `Found ${result.data?.length || 0} trending pools`, duration: options.duration || "24h", }; }
  • The input schema definition for the 'get_trending_pools' tool, specifying optional parameters like include, page, and duration.
    name: TOOL_NAMES.GET_TRENDING_POOLS, description: "Get trending pools across all networks on GeckoTerminal", inputSchema: { type: "object", properties: { include: { type: "string", description: "Attributes to include: 'base_token', 'quote_token', 'dex', 'network' (comma-separated)", }, page: { type: "integer", description: "Page number for pagination (optional, default: 1)", }, duration: { type: "string", description: "Duration for trending: '5m', '1h', '6h', '24h' (optional, default: '24h')", enum: ["5m", "1h", "6h", "24h"], }, }, required: [], },
  • src/index.js:1022-1028 (registration)
    The tool registration and dispatching logic in the MCP CallToolRequestSchema handler switch statement, which routes calls to the toolService.getTrendingPools method.
    case TOOL_NAMES.GET_TRENDING_POOLS: result = await toolService.getTrendingPools({ include: args.include, page: args.page, duration: args.duration, }); break;
  • Constant definition mapping the tool name 'get_trending_pools' used throughout the codebase for registration and dispatching.
    GET_TRENDING_POOLS: "get_trending_pools",
  • Supporting utility method in CoinGeckoApiService that performs the actual HTTP fetch to the CoinGecko API endpoint for trending pools.
    async getTrendingPools(options = {}) { try { const queryParams = new URLSearchParams(); if (options.include) queryParams.append('include', options.include); if (options.page) queryParams.append('page', options.page); if (options.duration) queryParams.append('duration', options.duration); const url = `${this.baseUrl}/networks/trending_pools${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 trending pools: ${error.message}`); } }

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