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
| Name | Required | Description | Default |
|---|---|---|---|
| userId | Yes |
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
- src/fatebook_mcp/__main__.py:375-394 (handler)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