Skip to main content
Glama
edkdev

DeFi Trading Agent MCP Server

by edkdev

get_trending_pools_by_network

Identify trending liquidity pools on a specific blockchain network to discover trading opportunities based on recent activity metrics.

Instructions

Get trending pools on a specific network

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
networkYesNetwork ID (e.g., 'eth', 'bsc', 'polygon_pos')
includeNoAttributes to include: 'base_token', 'quote_token', 'dex' (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_by_network' tool. It validates the network parameter, calls the CoinGecko API service, and returns a formatted response with message, data, summary, and duration.
    async getTrendingPoolsByNetwork(network, options = {}) {
      if (!network) {
        throw new Error("network is required");
      }
    
      const result = await this.coinGeckoApi.getTrendingPoolsByNetwork(
        network,
        options
      );
    
      return {
        message: `Trending pools for ${network} retrieved successfully`,
        data: result,
        summary: `Found ${result.data?.length || 0} trending pools on ${network}`,
        duration: options.duration || "24h",
      };
    }
  • The input schema definition for the tool registration in the MCP server tools array, specifying parameters: network (required), include, page, duration.
    name: TOOL_NAMES.GET_TRENDING_POOLS_BY_NETWORK,
    description: "Get trending pools on a specific network",
    inputSchema: {
      type: "object",
      properties: {
        network: {
          type: "string",
          description: "Network ID (e.g., 'eth', 'bsc', 'polygon_pos')",
        },
        include: {
          type: "string",
          description:
            "Attributes to include: 'base_token', 'quote_token', 'dex' (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: ["network"],
    },
  • src/index.js:1030-1036 (registration)
    Tool handler registration in the MCP CallToolRequest switch statement, mapping the tool name to the toolService method call.
    case TOOL_NAMES.GET_TRENDING_POOLS_BY_NETWORK:
      result = await toolService.getTrendingPoolsByNetwork(args.network, {
        include: args.include,
        page: args.page,
        duration: args.duration,
      });
      break;
  • Helper function in CoinGeckoApiService that makes the HTTP request to CoinGecko's trending pools endpoint for a specific network, handling query parameters and API key.
    async getTrendingPoolsByNetwork(network, 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/${network}/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 by network: ${error.message}`);
      }
    }
  • src/constants.js:23-23 (registration)
    Constant defining the exact tool name string used throughout the codebase for registration and dispatching.
    GET_TRENDING_POOLS_BY_NETWORK: "get_trending_pools_by_network",
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure but adds minimal information. It doesn't describe what 'trending' means algorithmically, whether this is a read-only operation (implied by 'Get' but not explicit), what the return format looks like, pagination behavior beyond the 'page' parameter, rate limits, or authentication requirements. For a tool with 4 parameters and no output schema, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that states the core purpose without unnecessary words. It's appropriately sized for a straightforward data retrieval tool and front-loads the essential information. Every word earns its place in this minimal description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (4 parameters, no annotations, no output schema), the description is insufficiently complete. It doesn't explain what constitutes 'trending' pools, what data is returned, how results are ordered, or provide any context about the data source or limitations. With no output schema and behavioral gaps, the agent lacks critical information to understand what this tool actually provides.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so all parameters are documented in the schema itself. The description adds no additional parameter information beyond what's already in the schema descriptions (network ID format, include attributes, pagination, duration options). This meets the baseline expectation when schema coverage is complete, but doesn't provide extra context like examples of network IDs beyond what's in the schema or clarification on 'include' parameter usage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and resource ('trending pools on a specific network'), making the purpose immediately understandable. It distinguishes from some siblings like 'get_trending_pools' (which lacks network specificity) and 'get_top_pools_by_dex/token' (which use different ranking criteria). However, it doesn't explicitly contrast with all similar tools like 'get_new_pools' or 'search_pools'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention what 'trending' means compared to 'top' pools, when to prefer this over 'get_new_pools' or 'search_pools', or any prerequisites for using it. The agent must infer usage context solely from the tool name and parameter schema.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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