Skip to main content
Glama
kukapay

crypto-feargreed-mcp

get_historical_fng_tool

Retrieve historical Crypto Fear & Greed Index data for analysis of market sentiment trends over a specified number of days.

Instructions

Get historical Fear & Greed Index for specified number of days as a tool.

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

Returns: str: Historical Fear & Greed Index values for the specified period.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daysYes

Implementation Reference

  • main.py:69-82 (handler)
    The handler function for the 'get_historical_fng_tool' MCP tool. It is registered via @mcp.tool() decorator, includes input schema in docstring and type hints, logs the request, and delegates to the core get_historical_fng helper.
    @mcp.tool()
    async def get_historical_fng_tool(days: int, ctx: Context) -> str:
        """
        Get historical Fear & Greed Index for specified number of days as a tool.
    
        Parameters:
            days (int): Number of days to retrieve (must be a positive integer).
    
        Returns:
            str: Historical Fear & Greed Index values for the specified period.
        """
        ctx.info(f"Fetching historical Fear & Greed Index for {days} days")
        return await get_historical_fng(str(days))
  • main.py:34-59 (helper)
    The core helper function that fetches historical Crypto Fear & Greed Index data from the API endpoint and formats the response. Called by the tool handler.
    @mcp.resource("fng://history/{days}")
    async def get_historical_fng(days: str) -> str:
        """Get historical Crypto Fear & Greed Index for specified number of days"""
        try:
            days_int = int(days)
            if days_int <= 0:
                raise ValueError("Days must be a positive integer")
            
            async with httpx.AsyncClient() as client:
                response = await client.get(API_URL, params={"limit": days_int})
                response.raise_for_status()
                data = response.json()["data"]
                
                result = ["Historical Crypto Fear & Greed Index:"]
                for entry in reversed(data):  # Latest first
                    timestamp = datetime.fromtimestamp(int(entry["timestamp"]))
                    result.append(
                        f"{timestamp} UTC: {entry['value']} ({entry['value_classification']})"
                    )
                return "\n".join(result)
        except ValueError as e:
            return f"Error: {str(e)}"
        except httpx.HTTPStatusError as e:
            return f"Error fetching historical FNG: {str(e)}"
        except Exception as e:
            return f"Unexpected error: {str(e)}"
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral context. It mentions the tool returns historical values as a string, but lacks details on data format, potential rate limits, error handling, or authentication needs. For a data retrieval tool with zero annotation coverage, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, with the core purpose stated first followed by parameter and return details. It avoids redundancy, though the phrase 'as a tool' is slightly verbose and could be omitted for tighter phrasing.

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

Completeness2/5

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

Given the tool's complexity (data retrieval with one parameter), lack of annotations, and no output schema, the description is incomplete. It doesn't explain the return format beyond 'str', missing details like data structure (e.g., JSON, CSV), timestamps, or error cases, which are critical for effective tool use.

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

Parameters3/5

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

Schema description coverage is 0%, so the description must compensate. It adds meaning by specifying that 'days' must be a positive integer and indicates it determines the retrieval period. However, it doesn't clarify constraints like maximum days, date ranges, or default values, leaving gaps in parameter understanding.

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

Purpose4/5

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

The description clearly states the tool retrieves historical Fear & Greed Index data for a specified number of days, using specific verbs ('Get', 'retrieve') and identifying the resource. It distinguishes from the sibling 'get_current_fng_tool' by specifying historical data, though it doesn't explicitly differentiate from 'analyze_fng_trend' which might involve analysis rather than retrieval.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus its siblings. It doesn't mention alternatives like 'get_current_fng_tool' for current data or 'analyze_fng_trend' for trend analysis, nor does it specify prerequisites or exclusions for usage.

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

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