Skip to main content
Glama

get_trending_words

Retrieve top trending cryptocurrency terms from aggregated discussions to identify market sentiment and popular topics over a specified period.

Instructions

Retrieve the top trending words in the crypto space over a specified period, aggregated and ranked by score.

Parameters:

  • days (int): Number of days to analyze trending words, defaults to 7.

  • top_n (int): Number of top trending words to return, defaults to 5.

Usage:

  • Call this tool to get a list of the most popular words trending in cryptocurrency discussions, ranked across the entire period.

Returns:

  • A string listing the top trending words (e.g., "Top 5 trending words over the past 7 days: 'halving', 'bullrun', 'defi', 'nft', 'pump'").

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daysNo
top_nNo

Implementation Reference

  • main.py:151-190 (handler)
    The main handler function for the 'get_trending_words' MCP tool, including decorator, type hints, docstring, and execution logic that aggregates trending words from Santiment API data.
    @mcp.tool()
    def get_trending_words(days: int = 7, top_n: int = 5) -> str:
        """
        Retrieve the top trending words in the crypto space over a specified period, aggregated and ranked by score.
        
        Parameters:
        - days (int): Number of days to analyze trending words, defaults to 7.
        - top_n (int): Number of top trending words to return, defaults to 5.
        
        Usage:
        - Call this tool to get a list of the most popular words trending in cryptocurrency discussions, ranked across the entire period.
        
        Returns:
        - A string listing the top trending words (e.g., "Top 5 trending words over the past 7 days: 'halving', 'bullrun', 'defi', 'nft', 'pump'").
        """
        try:
            data = fetch_trending_words(days)
            trends = data.get("data", {}).get("getTrendingWords", [])
            if not trends:
                return "Unable to fetch trending words. Check API subscription limits or connectivity."
            
            word_scores = {}
            for day in trends:
                for word_data in day["topWords"]:
                    word = word_data["word"]
                    score = word_data["score"]
                    if word in word_scores:
                        word_scores[word] += score
                    else:
                        word_scores[word] = score
            
            if not word_scores:
                return "No trending words data available for the specified period."
            
            top_words = sorted(word_scores.items(), key=lambda x: x[1], reverse=True)[:top_n]
            top_words_list = [word for word, _ in top_words]
            
            return f"Top {top_n} trending words over the past {days} days: {', '.join(top_words_list)}."
        except Exception as e:
            return f"Error fetching trending words: {str(e)}"
  • main.py:43-64 (helper)
    Helper function that queries the Santiment GraphQL API to fetch raw trending words data (getTrendingWords), used by the main handler.
    def fetch_trending_words(days: int = 7) -> dict:
        now = datetime.now(UTC)
        
        to_date = now
        from_date = to_date - timedelta(days=days)
        
        query = f"""
        {{
          getTrendingWords(size: 10, from: "{from_date.isoformat()}", to: "{to_date.isoformat()}", interval: "1d") {{
            datetime
            topWords {{
              word
              score
            }}
          }}
        }}
        """
        response = requests.post(SANTIMENT_API_URL, json={"query": query}, headers=HEADERS)
        result = response.json()
        if result.get("errors"):
            raise Exception(f"API error: {result.get('errors')}")
        return result
  • Function signature with type annotations and docstring defining input schema (days: int=7, top_n: int=5) and output (str) for the tool.
    def get_trending_words(days: int = 7, top_n: int = 5) -> str:
        """
        Retrieve the top trending words in the crypto space over a specified period, aggregated and ranked by score.
        
        Parameters:
        - days (int): Number of days to analyze trending words, defaults to 7.
        - top_n (int): Number of top trending words to return, defaults to 5.
        
        Usage:
        - Call this tool to get a list of the most popular words trending in cryptocurrency discussions, ranked across the entire period.
        
        Returns:
        - A string listing the top trending words (e.g., "Top 5 trending words over the past 7 days: 'halving', 'bullrun', 'defi', 'nft', 'pump'").
        """
  • main.py:151-151 (registration)
    The @mcp.tool() decorator that registers the get_trending_words function as an MCP tool.
    @mcp.tool()
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses the tool's read-only nature (implied by 'Retrieve'), the ranking method ('aggregated and ranked by score'), and the return format. However, it doesn't mention potential limitations like data sources, rate limits, or freshness of data, which would be helpful for a tool with no annotation coverage.

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 well-structured with distinct sections (purpose, parameters, usage, returns). Each sentence earns its place by providing essential information without redundancy. The front-loaded purpose statement immediately clarifies the tool's function.

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

Completeness4/5

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

For a tool with 2 parameters, no annotations, and no output schema, the description does a good job covering purpose, parameters, usage, and return format. However, it could be more complete by addressing potential behavioral aspects like data sources or limitations, given the lack of annotations.

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

Parameters4/5

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

The schema description coverage is 0%, so the description must compensate. It provides clear semantic meaning for both parameters: 'days' specifies the analysis period, and 'top_n' controls how many results to return. Default values are also explained. The description adds significant value beyond the bare schema, though it doesn't detail constraints like valid ranges.

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

Purpose5/5

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

The description clearly states the specific action ('Retrieve'), resource ('top trending words in the crypto space'), and scope ('over a specified period, aggregated and ranked by score'). It distinguishes this tool from siblings like get_sentiment_balance or get_social_volume by focusing on word trends rather than sentiment, dominance, or volume metrics.

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

Usage Guidelines4/5

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

The 'Usage' section provides clear context: 'Call this tool to get a list of the most popular words trending in cryptocurrency discussions, ranked across the entire period.' This gives guidance on when to use it, but doesn't explicitly mention when not to use it or name specific alternatives among the sibling tools.

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/kukapay/crypto-sentiment-mcp'

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