Skip to main content
Glama
edkdev

DeFi Trading Agent MCP Server

by edkdev

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
NameRequiredDescriptionDefault
addressesYesToken contract addresses, comma-separated for multiple tokens
includeNoAttributes to include: 'top_pools' (optional)
networkYesNetwork ID (e.g., 'eth', 'bsc', 'polygon_pos')

Implementation Reference

  • 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}`); } }
  • 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;
  • Constant definition for the tool name string.
    GET_MULTIPLE_TOKENS_DATA: "get_multiple_tokens_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