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
| Name | Required | Description | Default |
|---|---|---|---|
| network | Yes | Network ID (e.g., 'eth', 'bsc', 'polygon_pos') | |
| addresses | Yes | Pool contract addresses, comma-separated for multiple pools | |
| include | No | Attributes to include: 'base_token', 'quote_token', 'dex' (comma-separated) | |
| include_volume_breakdown | No | Include volume breakdown (optional, default: false) |
Implementation Reference
- src/toolService.js:209-227 (handler)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}`, }; }
- src/index.js:324-352 (schema)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",