add_forecast
Add a probability forecast to a prediction question on Fatebook to track and update your predictions over time.
Instructions
Add a forecast to a Fatebook question
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| questionId | Yes | ||
| forecast | Yes | ||
| apiKey | No | ||
| optionId | No |
Implementation Reference
- src/fatebook_mcp/__main__.py:253-285 (handler)The core handler function for the 'add_forecast' MCP tool. It validates inputs, constructs the API payload, and makes a POST request to the Fatebook API to add the forecast. Registered via @mcp.tool() decorator.@mcp.tool() async def add_forecast( questionId: str, forecast: float, apiKey: str = "", optionId: str = "" ) -> bool: """Add a forecast to a Fatebook question""" api_key = apiKey or os.getenv("FATEBOOK_API_KEY") if not api_key: raise ValueError( "API key is required (provide as parameter or set FATEBOOK_API_KEY environment variable)" ) # Validate forecast parameter if not 0 <= forecast <= 1: raise ValueError("forecast must be between 0 and 1") data = {"questionId": questionId, "forecast": forecast, "apiKey": api_key} # Add optional parameter for multi-choice questions if optionId: data["optionId"] = optionId try: async with httpx.AsyncClient() as client: response = await client.post("https://fatebook.io/api/v0/addForecast", json=data) response.raise_for_status() return True except httpx.HTTPError: raise except Exception: raise