Skip to main content
Glama
edkdev

DeFi Trading Agent MCP Server

by edkdev

get_multiple_tokens_data

Retrieve token data for multiple contracts on specified blockchain networks to support trading decisions and portfolio analysis.

Instructions

Get data for multiple tokens by their contract addresses

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
networkYesNetwork ID (e.g., 'eth', 'bsc', 'polygon_pos')
addressesYesToken contract addresses, comma-separated for multiple tokens
includeNoAttributes to include: 'top_pools' (optional)

Implementation Reference

  • Main MCP tool handler: validates inputs, delegates to CoinGeckoApiService, formats response with message, data, and summary.
    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(",") : [], }; }
  • Tool schema definition in ListTools handler: input schema, description, and name registration.
    { 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)
    Tool dispatch registration in CallToolRequestSchema switch statement: maps tool name to handler.
    case TOOL_NAMES.GET_MULTIPLE_TOKENS_DATA: result = await toolService.getMultipleTokensData( args.network, args.addresses, { include: args.include, } ); break;
  • Core helper: Constructs CoinGecko API URL for /networks/{network}/tokens/multi/{addresses} and performs authenticated fetch request.
    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}`); } }

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