Skip to main content
Glama

count_forecasts

Count predictions made by a specific user on Fatebook to track forecasting activity and history.

Instructions

Count forecasts for a specific user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
userIdYes

Implementation Reference

  • main.py:405-426 (handler)
    The main handler function for the 'count_forecasts' MCP tool. Decorated with @mcp.tool() for automatic registration and execution. Calls the Fatebook API to count forecasts for the given userId and returns the integer count.
    @mcp.tool() async def count_forecasts(ctx: Context, userId: str) -> int: """Count forecasts for a specific user""" params = {"userId": userId} try: async with httpx.AsyncClient() as client: response = await client.get("https://fatebook.io/api/v0/countForecasts", params=params) response.raise_for_status() # Parse JSON response and return the count data = response.json() return int(data.get("count", 0)) except httpx.HTTPError as e: await ctx.error(f"HTTP error occurred: {e}") raise except Exception as e: await ctx.error(f"Unexpected error occurred: {e}") raise
  • Package version handler function for the 'count_forecasts' MCP tool. Similar implementation without Context logging.
    @mcp.tool() async def count_forecasts(userId: str) -> int: """Count forecasts for a specific user""" params = {"userId": userId} try: async with httpx.AsyncClient() as client: response = await client.get("https://fatebook.io/api/v0/countForecasts", params=params) response.raise_for_status() # Parse JSON response and return the count data = response.json() return int(data.get("count", 0)) except httpx.HTTPError: raise except Exception: raise

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/an1lam/fatebook-mcp'

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