get_multiple_tokens_data
Retrieve token data by contract addresses on supported blockchains, including optional top pools information, for real-time market analysis in DeFi trading.
Instructions
Get data for multiple tokens by their contract addresses
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| addresses | Yes | Token contract addresses, comma-separated for multiple tokens | |
| include | No | Attributes to include: 'top_pools' (optional) | |
| network | Yes | Network ID (e.g., 'eth', 'bsc', 'polygon_pos') |
Implementation Reference
- src/toolService.js:319-338 (handler)Tool handler function that validates input, calls CoinGecko API service, and formats the response for MCP.async getMultipleTokensData(network, addresses, options = {}) { if (!network || !addresses) { throw new Error("Missing required parameters: network, addresses"); } const result = await this.coinGeckoApi.getMultipleTokensData( network, addresses, options ); return { message: "Multiple tokens data retrieved successfully", data: result, summary: `Retrieved data for ${ addresses.split(",").length } token(s) on ${network}`, includes: options.include ? options.include.split(",") : [], }; }
- Core helper function that makes the actual HTTP request to CoinGecko API for multiple tokens data.async getMultipleTokensData(network, addresses, options = {}) { try { const queryParams = new URLSearchParams(); if (options.include) queryParams.append('include', options.include); const url = `${this.baseUrl}/networks/${network}/tokens/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 tokens data: ${error.message}`); } }
- src/index.js:496-518 (schema)Input schema definition for the get_multiple_tokens_data tool in the MCP tools list.name: TOOL_NAMES.GET_MULTIPLE_TOKENS_DATA, description: "Get data for multiple tokens by their contract addresses", inputSchema: { type: "object", properties: { network: { type: "string", description: "Network ID (e.g., 'eth', 'bsc', 'polygon_pos')", }, addresses: { type: "string", description: "Token contract addresses, comma-separated for multiple tokens", }, include: { type: "string", description: "Attributes to include: 'top_pools' (optional)", enum: ["top_pools"], }, }, required: ["network", "addresses"], }, },
- src/index.js:1090-1098 (registration)Registration in the MCP tool call dispatcher switch statement that routes to the tool handler.case TOOL_NAMES.GET_MULTIPLE_TOKENS_DATA: result = await toolService.getMultipleTokensData( args.network, args.addresses, { include: args.include, } ); break;
- src/constants.js:32-32 (helper)Constant definition for the tool name string.GET_MULTIPLE_TOKENS_DATA: "get_multiple_tokens_data",