Skip to main content
Glama

get_current_fng_tool

Retrieve the current Crypto Fear & Greed Index value to gauge market sentiment and inform cryptocurrency investment decisions.

Instructions

Get the current Crypto Fear & Greed Index as a tool.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • main.py:62-66 (handler)
    The handler function for the 'get_current_fng_tool' tool. It is decorated with @mcp.tool() for registration and delegates to the helper get_current_fng() after logging.
    @mcp.tool() async def get_current_fng_tool(ctx: Context) -> str: """Get the current Crypto Fear & Greed Index as a tool.""" ctx.info("Fetching current Fear & Greed Index") return await get_current_fng()
  • main.py:14-32 (helper)
    Supporting resource function that implements the core logic of fetching and formatting the current Crypto Fear & Greed Index from the API endpoint.
    @mcp.resource("fng://current") async def get_current_fng() -> str: """Get the current Crypto Fear & Greed Index""" try: async with httpx.AsyncClient() as client: response = await client.get(API_URL, params={"limit": 1}) response.raise_for_status() data = response.json()["data"][0] timestamp = datetime.fromtimestamp(int(data["timestamp"])) return ( f"Crypto Fear & Greed Index (as of {timestamp} UTC):\n" f"Value: {data['value']}\n" f"Classification: {data['value_classification']}" ) except httpx.HTTPStatusError as e: return f"Error fetching current FNG: {str(e)}" except Exception as e: return f"Unexpected error: {str(e)}"

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