Skip to main content
Glama
JCF0

CG Alpha MCP

by JCF0

elfa_trending_tokens

Identify trending cryptocurrency tokens by analyzing aggregated sentiment data across specified timeframes and blockchain networks to support market analysis decisions.

Instructions

Trending tokens aggregation. Params: timeframe, chain, limit, cursor.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timeframeNo
chainNo
limitNo
cursorNo

Implementation Reference

  • Primary MCP tool handler for 'elfa_trending_tokens'. Parses input arguments into query parameters and delegates to the generic 'elfa_query' tool which fetches from the ELFA API endpoint '/v2/aggregations/trending-tokens'.
    "elfa_trending_tokens": async (args, meta) => {
      const query = {};
      if (args && args.timeframe !== undefined) query.timeframe = args.timeframe; // "24h","7d","30d"
      if (args && args.chain     !== undefined) query.chain     = args.chain;
      if (args && args.limit     !== undefined) query.limit     = args.limit;
      if (args && args.cursor    !== undefined) query.cursor    = args.cursor;
      return toolHandlers["elfa_query"]({ path: "/v2/aggregations/trending-tokens", method: "GET", query }, meta);
    },
  • Tool schema definition including input schema, description, and annotations for registration in the MCP tools list.
    { name:"elfa_trending_tokens",
      description:"Trending tokens aggregation. Params: timeframe, chain, limit, cursor.",
      inputSchema:{ type:"object", properties:{
        timeframe:{type:"string"}, chain:{type:"string"}, limit:{type:"number"}, cursor:{type:"string"}
      }},
      annotations:{ title:"ELFA: Trending Tokens", readOnlyHint:true, openWorldHint:true }
  • Supporting handler function 'elfaTrendingTokens' (camelCase) that performs the API call to the same ELFA endpoint. Used in the HTTP debug server (index.js).
    export const elfaTrendingTokens = async ({ timeWindow='7d', page=1, pageSize=50, minMentions=5, from=null, to=null }) => {
      const params = { page, pageSize, minMentions };
      if (from != null && to != null) { params.from = from; params.to = to; }
      else { params.timeWindow = timeWindow; }
      return safeGet('/v2/aggregations/trending-tokens', params);
    };
  • mcp-server.js:185-187 (registration)
    Alias handler 'elfa_trending' that registers and delegates directly to the 'elfa_trending_tokens' implementation.
    "elfa_trending": async (args, meta) => {
      return toolHandlers["elfa_trending_tokens"](args, meta);
    },
  • Generic helper 'elfaFetch' used by the 'elfa_query' tool to perform HTTP requests to the ELFA API.
    async function elfaFetch(pathname, options){
      const o = options || {};
      const method = (o.method || "GET").toUpperCase();
      const query = o.query || null;
      const body  = o.body  || null;
    
      const url = new URL(pathname, ELFA_BASE);
      if (query && typeof query === "object") {
        for (const k of Object.keys(query)) {
          const v = query[k];
          if (v !== undefined && v !== null) url.searchParams.set(k, String(v));
        }
      }
    
      const headers = { "Accept": "application/json" };
      applyAuth(headers);
      if (body && method !== "GET") headers["Content-Type"] = "application/json";
    
      const res = await fetch(url, { method, headers, body: body && method !== "GET" ? JSON.stringify(body) : undefined });
      const raw = await res.text();
      let data; try { data = raw ? JSON.parse(raw) : null; } catch { data = { raw }; }
      return { ok: res.ok, status: res.status, 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/JCF0/cg-alpha-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server