Skip to main content
Glama

DeFi Trading Agent MCP Server

by edkdev

get_pool_trades

Retrieve recent trades for a specific DeFi pool, filtered by network and contract address, with optional volume thresholds for precise market analysis.

Instructions

Get recent trades for a specific pool

Input 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)

Input Schema (JSON Schema)

{ "properties": { "network": { "description": "Network ID (e.g., 'eth', 'bsc', 'polygon_pos')", "type": "string" }, "poolAddress": { "description": "Pool contract address", "type": "string" }, "trade_volume_in_usd_greater_than": { "description": "Filter trades with volume greater than this USD amount (optional)", "type": "number" } }, "required": [ "network", "poolAddress" ], "type": "object" }

Implementation Reference

  • Main handler function for get_pool_trades tool that validates inputs, calls CoinGecko API service, and 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", }; }
  • src/index.js:1127-1136 (registration)
    MCP server dispatch/registration in CallToolRequestSchema handler switch statement that routes calls to toolService.getPoolTrades.
    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;
  • Tool registration in ListToolsRequestSchema including name, description, and input schema validation.
    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"], }, },
  • Low-level helper that makes the actual HTTP request to CoinGecko API for pool trades data.
    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}`); } }
  • src/constants.js:36-36 (registration)
    Constant definition for the tool name used throughout the codebase.
    GET_POOL_TRADES: "get_pool_trades",

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