Skip to main content
Glama
edkdev

DeFi Trading Agent MCP Server

by edkdev

get_pool_trades

Retrieve recent trades for a specific DeFi liquidity pool to analyze trading activity and volume patterns.

Instructions

Get recent trades for a specific pool

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
networkYesNetwork ID (e.g., 'eth', 'bsc', 'polygon_pos')
poolAddressYesPool contract address
trade_volume_in_usd_greater_thanNoFilter trades with volume greater than this USD amount (optional)

Implementation Reference

  • Main handler function for the get_pool_trades tool. Validates parameters and delegates to CoinGecko API service, then formats the response.
    async getPoolTrades(network, poolAddress, options = {}) {
      if (!network || !poolAddress) {
        throw new Error("Missing required parameters: network, poolAddress");
      }
    
      const result = await this.coinGeckoApi.getPoolTrades(
        network,
        poolAddress,
        options
      );
    
      return {
        message: `Pool trades for ${poolAddress} on ${network} retrieved successfully`,
        data: result,
        summary: `Found ${result.data?.length || 0} trades for pool`,
        minVolumeFilter: options.trade_volume_in_usd_greater_than || "none",
      };
    }
  • Input schema definition for the get_pool_trades tool, including parameters and validation rules.
    name: TOOL_NAMES.GET_POOL_TRADES,
    description: "Get recent trades for a specific pool",
    inputSchema: {
      type: "object",
      properties: {
        network: {
          type: "string",
          description: "Network ID (e.g., 'eth', 'bsc', 'polygon_pos')",
        },
        poolAddress: {
          type: "string",
          description: "Pool contract address",
        },
        trade_volume_in_usd_greater_than: {
          type: "number",
          description:
            "Filter trades with volume greater than this USD amount (optional)",
        },
      },
      required: ["network", "poolAddress"],
    },
  • src/index.js:1127-1136 (registration)
    Registration and dispatch logic in the main switch case that routes tool calls to the handler.
    case TOOL_NAMES.GET_POOL_TRADES:
      result = await toolService.getPoolTrades(
        args.network,
        args.poolAddress,
        {
          trade_volume_in_usd_greater_than:
            args.trade_volume_in_usd_greater_than,
        }
      );
      break;
  • Core helper function that performs the actual API call to CoinGecko for retrieving pool trades.
    async getPoolTrades(network, poolAddress, options = {}) {
      try {
        const queryParams = new URLSearchParams();
        
        if (options.trade_volume_in_usd_greater_than) queryParams.append('trade_volume_in_usd_greater_than', options.trade_volume_in_usd_greater_than);
    
        const url = `${this.baseUrl}/networks/${network}/pools/${poolAddress}/trades${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 pool trades: ${error.message}`);
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions 'recent trades' but doesn't specify time ranges, pagination, rate limits, authentication needs, or what 'recent' means. For a read operation with no structured safety hints, 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 with zero waste—it directly states the tool's function without fluff. It's appropriately sized for a straightforward data retrieval tool.

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 no annotations and no output schema, the description is incomplete. It doesn't explain return values (e.g., trade format, timestamps), behavioral constraints, or error handling. For a tool with three parameters and complex sibling context, this lacks necessary context for reliable agent use.

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 the schema already documents all three parameters thoroughly. The description adds no additional meaning beyond implying 'pool' relates to 'poolAddress', which the schema covers. Baseline 3 is appropriate as the schema does the heavy lifting.

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 verb ('Get') and resource ('recent trades for a specific pool'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'get_pool_ohlcv' or 'get_multiple_pools_data' that might also retrieve pool-related data, preventing a perfect score.

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?

No guidance is provided on when to use this tool versus alternatives. With siblings like 'get_pool_ohlcv' (likely for OHLCV data) and 'get_multiple_pools_data' (for broader pool metrics), the description lacks any context for selection, leaving the agent to infer based on names alone.

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