create_question
Create prediction questions on Fatebook to track forecasts with deadlines, probabilities, and sharing options for collaborative forecasting.
Instructions
Create a new Fatebook question
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | ||
| resolveBy | Yes | ||
| forecast | Yes | ||
| apiKey | No | ||
| tags | No | ||
| sharePublicly | No | ||
| shareWithLists | No | ||
| shareWithEmail | No | ||
| hideForecastsUntil | No |
Implementation Reference
- src/fatebook_mcp/__main__.py:184-251 (handler)Implementation of the create_question tool handler. Posts to Fatebook API to create a question, parses the response URL to extract question ID, and returns QuestionReference.@mcp.tool() async def create_question( title: str, resolveBy: str, forecast: float, apiKey: str = "", tags: list[str] = [], sharePublicly: bool = False, shareWithLists: list[str] = [], shareWithEmail: list[str] = [], hideForecastsUntil: str = "", ) -> QuestionReference: """Create a new 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") params: ParamsType = { "apiKey": api_key, "title": title, "resolveBy": resolveBy, "forecast": forecast, } # Add optional parameters if tags: params["tags"] = ",".join(tags) if sharePublicly: params["sharePublicly"] = sharePublicly if shareWithLists: params["shareWithLists"] = ",".join(shareWithLists) if shareWithEmail: params["shareWithEmail"] = ",".join(shareWithEmail) if hideForecastsUntil: params["hideForecastsUntil"] = hideForecastsUntil try: async with httpx.AsyncClient() as client: response = await client.post("https://fatebook.io/api/v0/createQuestion", params=params) response.raise_for_status() # Parse the URL from the response to extract title and ID url = response.text.strip() if url.startswith("https://fatebook.io/q/"): # Extract the slug part after /q/ slug = url.replace("https://fatebook.io/q/", "") # Split on the last occurrence of -- to separate title and ID if "--" in slug: url_title, question_id = slug.rsplit("--", 1) return QuestionReference(id=question_id, title=title) else: raise ValueError(f"Could not parse question ID from URL: {url}") else: raise ValueError(f"Unexpected response format: {url}") except httpx.HTTPError: raise except Exception: raise
- src/fatebook_mcp/models.py:204-209 (schema)Pydantic model defining the output schema (QuestionReference) returned by create_question tool.class QuestionReference(BaseModel): """Minimal question reference with id and title""" id: str title: str
- src/fatebook_mcp/__main__.py:184-185 (registration)MCP tool registration decorator for create_question.@mcp.tool() async def create_question(