Skip to main content
Glama
edkdev

DeFi Trading Agent MCP Server

by edkdev

get_token_data

Retrieve token information by contract address to analyze DeFi assets, including network data and optional liquidity pool details for trading decisions.

Instructions

Get specific token data by contract address

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
networkYesNetwork ID (e.g., 'eth', 'bsc', 'polygon_pos')
addressYesToken contract address
includeNoAttributes to include: 'top_pools' (optional)

Implementation Reference

  • Input schema and description for the 'get_token_data' tool, registered in MCP server's tools list.
      name: TOOL_NAMES.GET_TOKEN_DATA,
      description: "Get specific token data by contract address",
      inputSchema: {
        type: "object",
        properties: {
          network: {
            type: "string",
            description: "Network ID (e.g., 'eth', 'bsc', 'polygon_pos')",
          },
          address: {
            type: "string",
            description: "Token contract address",
          },
          include: {
            type: "string",
            description: "Attributes to include: 'top_pools' (optional)",
            enum: ["top_pools"],
          },
        },
        required: ["network", "address"],
      },
    },
  • MCP request handler dispatch case that executes the tool by calling toolService.getTokenData with input arguments.
    case TOOL_NAMES.GET_TOKEN_DATA:
      result = await toolService.getTokenData(args.network, args.address, {
        include: args.include,
      });
      break;
  • ToolService wrapper that invokes CoinGecko API service and wraps the response with additional metadata.
    async getTokenData(network, address, options = {}) {
      if (!network || !address) {
        throw new Error("Missing required parameters: network, address");
      }
    
      const result = await this.coinGeckoApi.getTokenData(
        network,
        address,
        options
      );
    
      return {
        message: `Token data for ${address} on ${network} retrieved successfully`,
        data: result,
        summary: `Retrieved data for token ${
          result.data?.attributes?.symbol || address
        }`,
        includes: options.include ? options.include.split(",") : [],
      };
    }
  • Core handler implementation: Makes HTTP request to CoinGecko API to fetch token data by network and address.
    async getTokenData(network, address, options = {}) {
      try {
        const queryParams = new URLSearchParams();
        
        if (options.include) queryParams.append('include', options.include);
    
        const url = `${this.baseUrl}/networks/${network}/tokens/${address}${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 token data: ${error.message}`);
      }
    }
  • src/constants.js:31-31 (registration)
    TOOL_NAMES constant defining the tool name 'get_token_data' used in registration and dispatch.
    GET_TOKEN_DATA: "get_token_data",
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure but offers minimal information. It doesn't describe response format, error conditions, rate limits, authentication needs, or whether this is a read-only operation. While 'Get' implies reading, explicit confirmation of safety or side effects would be valuable given the lack of annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose without unnecessary words. It avoids redundancy with the tool name and schema, making it easy to parse quickly. Every word earns its place in conveying the essential function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 3 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what 'token data' returns, how results are structured, or any behavioral nuances. Given the complexity of blockchain data retrieval and the lack of structured context, more detail is needed to guide effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all three parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema, such as explaining the relationship between 'network' and 'address' or clarifying the 'include' option's impact. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and target resource ('specific token data by contract address'), making the purpose immediately understandable. It distinguishes from siblings like 'get_token_info' or 'get_token_price' by focusing on contract-address-based data retrieval. However, it doesn't specify what 'token data' includes beyond what the schema suggests.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'get_token_info', 'get_token_price', or 'get_multiple_tokens_data'. The description doesn't mention prerequisites, constraints, or typical use cases, leaving the agent to infer usage from the tool name and parameters alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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