Skip to main content
Glama
edkdev

DeFi Trading Agent MCP Server

by edkdev

get_multiple_pools_data

Retrieve comprehensive data for multiple DeFi liquidity pools by contract addresses to analyze trading opportunities across different networks and DEXs.

Instructions

Get data for multiple pools by their contract addresses

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
networkYesNetwork ID (e.g., 'eth', 'bsc', 'polygon_pos')
addressesYesPool contract addresses, comma-separated for multiple pools
includeNoAttributes to include: 'base_token', 'quote_token', 'dex' (comma-separated)
include_volume_breakdownNoInclude volume breakdown (optional, default: false)

Implementation Reference

  • Main handler function for the 'get_multiple_pools_data' tool. Validates input parameters and delegates to the CoinGecko API service to fetch data for multiple pools.
    async getMultiplePoolsData(network, addresses, options = {}) { if (!network || !addresses) { throw new Error("Missing required parameters: network, addresses"); } const result = await this.coinGeckoApi.getMultiplePoolsData( network, addresses, options ); return { message: "Multiple pools data retrieved successfully", data: result, summary: `Retrieved data for ${ addresses.split(",").length } pool(s) on ${network}`, }; }
  • MCP tool schema definition including input validation schema for 'get_multiple_pools_data'.
    { name: TOOL_NAMES.GET_MULTIPLE_POOLS_DATA, description: "Get data for multiple pools by their contract addresses", inputSchema: { type: "object", properties: { network: { type: "string", description: "Network ID (e.g., 'eth', 'bsc', 'polygon_pos')", }, addresses: { type: "string", description: "Pool contract addresses, comma-separated for multiple pools", }, include: { type: "string", description: "Attributes to include: 'base_token', 'quote_token', 'dex' (comma-separated)", }, include_volume_breakdown: { type: "boolean", description: "Include volume breakdown (optional, default: false)", }, }, required: ["network", "addresses"], }, },
  • src/index.js:1038-1047 (registration)
    Tool registration in the MCP CallToolRequestHandler switch statement, dispatching calls to the toolService handler.
    case TOOL_NAMES.GET_MULTIPLE_POOLS_DATA: result = await toolService.getMultiplePoolsData( args.network, args.addresses, { include: args.include, include_volume_breakdown: args.include_volume_breakdown, } ); break;
  • Core helper function that makes the HTTP request to CoinGecko API to retrieve data for multiple pools by addresses.
    async getMultiplePoolsData(network, addresses, options = {}) { try { const queryParams = new URLSearchParams(); if (options.include) queryParams.append('include', options.include); if (options.include_volume_breakdown) queryParams.append('include_volume_breakdown', options.include_volume_breakdown); const url = `${this.baseUrl}/networks/${network}/pools/multi/${addresses}${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 multiple pools data: ${error.message}`); } }
  • src/constants.js:24-24 (registration)
    Tool name constant definition used for registration.
    GET_MULTIPLE_POOLS_DATA: "get_multiple_pools_data",

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