Skip to main content
Glama
edkdev

DeFi Trading Agent MCP Server

by edkdev

get_recently_updated_tokens

Retrieve recently updated token information for DeFi trading analysis, with optional network filtering to support cross-chain portfolio decisions.

Instructions

Get recently updated tokens with their information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
includeNoAttributes to include: 'network' (optional)
networkNoNetwork ID to filter by (optional, e.g., 'eth', 'bsc', 'polygon_pos')

Implementation Reference

  • The primary handler function for the 'get_recently_updated_tokens' tool. It calls the CoinGecko API service and formats the response for the MCP protocol.
    async getRecentlyUpdatedTokens(options = {}) {
      const result = await this.coinGeckoApi.getRecentlyUpdatedTokens(options);
    
      return {
        message: "Recently updated tokens retrieved successfully",
        data: result,
        summary: `Found ${result.data?.length || 0} recently updated tokens${
          options.network ? ` on ${options.network}` : " across all networks"
        }`,
        includes: options.include ? options.include.split(",") : [],
      };
    }
  • The tool schema definition including name, description, and input schema for validation in the MCP ListTools response.
    {
      name: TOOL_NAMES.GET_RECENTLY_UPDATED_TOKENS,
      description: "Get recently updated tokens with their information",
      inputSchema: {
        type: "object",
        properties: {
          include: {
            type: "string",
            description: "Attributes to include: 'network' (optional)",
            enum: ["network"],
          },
          network: {
            type: "string",
            description:
              "Network ID to filter by (optional, e.g., 'eth', 'bsc', 'polygon_pos')",
          },
        },
        required: [],
      },
    },
  • src/index.js:1104-1109 (registration)
    The switch case registration that routes CallTool requests for 'get_recently_updated_tokens' to the toolService handler.
    case TOOL_NAMES.GET_RECENTLY_UPDATED_TOKENS:
      result = await toolService.getRecentlyUpdatedTokens({
        include: args.include,
        network: args.network,
      });
      break;
  • The underlying API service method that performs the actual HTTP request to CoinGecko's /tokens/info_recently_updated endpoint.
    async getRecentlyUpdatedTokens(options = {}) {
      try {
        const queryParams = new URLSearchParams();
        
        if (options.include) queryParams.append('include', options.include);
        if (options.network) queryParams.append('network', options.network);
    
        const url = `${this.baseUrl}/tokens/info_recently_updated${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 recently updated tokens: ${error.message}`);
      }
    }
  • Constant definition mapping the tool name enum to the string 'get_recently_updated_tokens' used throughout the codebase.
    GET_RECENTLY_UPDATED_TOKENS: "get_recently_updated_tokens",

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