Skip to main content
Glama
edkdev

DeFi Trading Agent MCP Server

by edkdev

get_token_info

Retrieve detailed token information including socials, websites, and descriptions for DeFi trading analysis and decision-making.

Instructions

Get detailed token information including socials, websites, and description

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
networkYesNetwork ID (e.g., 'eth', 'bsc', 'polygon_pos')
addressYesToken contract address

Implementation Reference

  • MCP tool schema definition and registration in the ListTools handler, specifying input schema requiring network and address.
      name: TOOL_NAMES.GET_TOKEN_INFO,
      description:
        "Get detailed token information including socials, websites, and description",
      inputSchema: {
        type: "object",
        properties: {
          network: {
            type: "string",
            description: "Network ID (e.g., 'eth', 'bsc', 'polygon_pos')",
          },
          address: {
            type: "string",
            description: "Token contract address",
          },
        },
        required: ["network", "address"],
      },
    },
  • src/index.js:1100-1102 (registration)
    Tool dispatching/registration in the CallToolRequestSchema handler switch statement.
    case TOOL_NAMES.GET_TOKEN_INFO:
      result = await toolService.getTokenInfo(args.network, args.address);
      break;
  • Service layer handler that validates parameters, calls CoinGeckoApiService, and formats the response for the MCP tool.
    async getTokenInfo(network, address) {
      if (!network || !address) {
        throw new Error("Missing required parameters: network, address");
      }
    
      const result = await this.coinGeckoApi.getTokenInfo(network, address);
    
      return {
        message: `Token info for ${address} on ${network} retrieved successfully`,
        data: result,
        summary: `Retrieved detailed info for token ${
          result.data?.attributes?.symbol || address
        }`,
        note: "This endpoint provides additional token information like socials, websites, and description",
      };
    }
  • Core implementation handler that performs the actual HTTP fetch to CoinGecko's onchain API endpoint for detailed token information.
    async getTokenInfo(network, address) {
      try {
        const url = `${this.baseUrl}/networks/${network}/tokens/${address}/info`;
        
        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 token info: ${error.message}`);
      }
    }
  • Constant definition mapping the symbolic name TOOL_NAMES.GET_TOKEN_INFO to the string tool name 'get_token_info' used throughout the codebase.
    GET_TOKEN_INFO: "get_token_info",

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