Skip to main content
Glama

alert_social_shift

Detect significant spikes or drops in cryptocurrency social volume to identify sudden changes in market attention for any asset.

Instructions

Detect significant shifts (spikes or drops) in social volume (social_volume_total) for a given asset.

Parameters:

  • asset (str): The cryptocurrency slug (e.g., "bitcoin", "ethereum"). Required.

  • threshold (float): Minimum percentage change (absolute value) to trigger an alert, defaults to 50.0 (i.e., 50%).

  • days (int): Number of days to analyze for baseline volume, defaults to 7.

Usage:

  • Call this tool to check if the latest social volume has significantly spiked or dropped compared to the previous average.

Returns:

  • A string indicating if a shift occurred (e.g., "Bitcoin's social volume spiked by 75.0% in the last 24 hours" or "Bitcoin's social volume dropped by 60.0% in the last 24 hours").

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
assetYes
thresholdNo
daysNo

Implementation Reference

  • main.py:116-116 (registration)
    The @mcp.tool() decorator registers the alert_social_shift tool with the FastMCP server.
    @mcp.tool()
  • main.py:117-150 (handler)
    The core handler function that implements the alert_social_shift tool logic: fetches social volume data, computes percentage change from prior average, and returns an alert message if the change exceeds the threshold.
    def alert_social_shift(asset: str, threshold: float = 50.0, days: int = 7) -> str:
        """
        Detect significant shifts (spikes or drops) in social volume (social_volume_total) for a given asset.
        
        Parameters:
        - asset (str): The cryptocurrency slug (e.g., "bitcoin", "ethereum"). Required.
        - threshold (float): Minimum percentage change (absolute value) to trigger an alert, defaults to 50.0 (i.e., 50%).
        - days (int): Number of days to analyze for baseline volume, defaults to 7.
        
        Usage:
        - Call this tool to check if the latest social volume has significantly spiked or dropped compared to the previous average.
        
        Returns:
        - A string indicating if a shift occurred (e.g., "Bitcoin's social volume spiked by 75.0% in the last 24 hours" or "Bitcoin's social volume dropped by 60.0% in the last 24 hours").
        """
        try:
            data = fetch_santiment_data("social_volume_total", asset, days)
            timeseries = data.get("data", {}).get("getMetric", {}).get("timeseriesData", [])
            
            if not timeseries or len(timeseries) < 2:
                return f"Unable to detect social volume shift for {asset}, insufficient data."
            
            latest_volume = int(timeseries[-1]["value"])  # Latest day's volume
            prev_avg_volume = sum(int(d["value"]) for d in timeseries[:-1]) / (len(timeseries) - 1)  # Average of previous days
            change_percent = ((latest_volume - prev_avg_volume) / prev_avg_volume) * 100
            
            abs_change = abs(change_percent)
            if abs_change >= threshold:
                direction = "spiked" if change_percent > 0 else "dropped"
                return f"{asset.capitalize()}'s social volume {direction} by {abs_change:.1f}% in the last 24 hours, from an average of {prev_avg_volume:,.0f} to {latest_volume:,}."
            return f"No significant shift detected for {asset.capitalize()}, change is {change_percent:.1f}%."
        except Exception as e:
            return f"Error detecting social volume shift for {asset}: {str(e)}"
  • main.py:16-42 (helper)
    Supporting helper function to query Santiment GraphQL API for timeseries metric data (e.g., social_volume_total), which is called by alert_social_shift.
    def fetch_santiment_data(metric: str, asset: str, days: int) -> dict:
        now = datetime.now(UTC)
        
        to_date = now
        from_date = to_date - timedelta(days=days)
        
        query = f"""
        {{
          getMetric(metric: "{metric}") {{
            timeseriesData(
              slug: "{asset}"
              from: "{from_date.isoformat()}"
              to: "{to_date.isoformat()}"
              interval: "1d"
            ) {{
              datetime
              value
            }}
          }}
        }}
        """
        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
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 of behavioral disclosure. It describes what the tool does (detects shifts based on percentage change) and the return format (a string indicating shift occurrence). However, it doesn't mention important behavioral aspects like rate limits, authentication requirements, data freshness, or error conditions that would help an agent use it correctly.

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 clear sections (purpose, parameters, usage, returns) and every sentence earns its place. It's appropriately sized at 4 sentences plus parameter explanations, with no redundant information.

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

Completeness3/5

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

Given no annotations, 0% schema description coverage, and no output schema, the description does a decent job explaining purpose, parameters, and returns. However, for a tool that performs analysis and returns alerts, it lacks details about the algorithm (e.g., how baseline is calculated), time windows for comparison, and potential limitations that would help an agent use it effectively.

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 explanations for all three parameters: 'asset' is explained as 'cryptocurrency slug', 'threshold' as 'minimum percentage change', and 'days' as 'number of days to analyze for baseline volume'. Default values are also documented. This adds substantial value beyond the bare schema.

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 tool's purpose with specific verbs ('detect significant shifts'), resource ('social volume for a given asset'), and scope ('spikes or drops in social_volume_total'). It distinguishes from sibling tools like get_social_volume (which presumably returns raw volume) by focusing on change detection and alerts.

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 explicitly states when to use this tool ('to check if the latest social volume has significantly spiked or dropped compared to the previous average'). However, it doesn't provide guidance on when NOT to use it or mention alternatives among the sibling tools (e.g., when to use get_social_volume instead).

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