Skip to main content
Glama

analyze_fng_trend

Analyze Crypto Fear & Greed Index trends over a specified period to identify market sentiment patterns and direction.

Instructions

Analyze trends in Crypto Fear & Greed Index over specified days.

Parameters: days (int): Number of days to analyze (must be a positive integer).

Returns: str: A string containing the analysis results, including latest value, average value, trend direction, and number of data points analyzed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daysYes

Implementation Reference

  • main.py:85-129 (handler)
    The main handler function for the 'analyze_fng_trend' tool. It fetches historical Fear & Greed Index data for the specified number of days, computes statistics like average value and trend direction, and returns a formatted analysis string.
    async def analyze_fng_trend(days: int, ctx: Context) -> str: """ Analyze trends in Crypto Fear & Greed Index over specified days. Parameters: days (int): Number of days to analyze (must be a positive integer). Returns: str: A string containing the analysis results, including latest value, average value, trend direction, and number of data points analyzed. """ if days <= 0: return "Error: Days must be a positive integer" ctx.info(f"Fetching {days} days of FNG data") try: async with httpx.AsyncClient() as client: response = await client.get(API_URL, params={"limit": days}) response.raise_for_status() data = response.json()["data"] if not data: return "Error: No data available" values = [int(entry["value"]) for entry in data] total_entries = len(values) # Calculate statistics avg = sum(values) / total_entries trend = "rising" if values[0] > values[-1] else "falling" if values[0] < values[-1] else "stable" latest = data[0] # Most recent entry result = [ f"Fear & Greed Index Analysis ({days} days):", f"Latest Value: {latest['value']} ({latest['value_classification']}) " f"at {datetime.fromtimestamp(int(latest['timestamp']))} UTC", f"Average Value: {avg:.1f}", f"Trend: {trend}", f"Data points analyzed: {total_entries}" ] return "\n".join(result) except httpx.HTTPStatusError as e: return f"Error fetching data: {str(e)}" except Exception as e: return f"Unexpected error: {str(e)}"
  • main.py:85-85 (registration)
    The @mcp.tool() decorator registers the 'analyze_fng_trend' function as an MCP tool.
    async def analyze_fng_trend(days: int, ctx: Context) -> str:
  • main.py:86-95 (schema)
    The docstring provides the input schema (days: int) and output description for the tool.
    """ Analyze trends in Crypto Fear & Greed Index over specified days. Parameters: days (int): Number of days to analyze (must be a positive integer). Returns: str: A string containing the analysis results, including latest value, average value, trend direction, and number of data points analyzed. """

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-feargreed-mcp'

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