add_comment
Add comments to Fatebook prediction questions to provide context, updates, or reasoning for forecasts on the prediction tracking platform.
Instructions
Add a comment to a Fatebook question
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| questionId | Yes | ||
| comment | Yes | ||
| apiKey | No |
Implementation Reference
- main.py:307-331 (handler)The main handler function for the 'add_comment' tool. It is decorated with @mcp.tool() which both defines the tool schema from the function signature and registers it with the MCP server. The function validates the API key, constructs the request data, and posts to the Fatebook API endpoint to add a comment to the specified question.@mcp.tool() async def add_comment(ctx: Context, questionId: str, comment: str, apiKey: str = "") -> bool: """Add a comment to a Fatebook question""" api_key = apiKey or os.getenv("FATEBOOK_API_KEY") if not api_key: await ctx.error("API key is required but not provided") raise ValueError( "API key is required (provide as parameter or set FATEBOOK_API_KEY environment variable)" ) data = {"questionId": questionId, "comment": comment, "apiKey": api_key} try: async with httpx.AsyncClient() as client: response = await client.post("https://fatebook.io/api/v0/addComment", json=data) response.raise_for_status() return True 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:287-308 (handler)Alternative implementation of the 'add_comment' tool handler in the package entrypoint. Similar logic but without Context logging.@mcp.tool() async def add_comment(questionId: str, comment: str, apiKey: str = "") -> bool: """Add a comment 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)" ) data = {"questionId": questionId, "comment": comment, "apiKey": api_key} try: async with httpx.AsyncClient() as client: response = await client.post("https://fatebook.io/api/v0/addComment", json=data) response.raise_for_status() return True except httpx.HTTPError: raise except Exception: raise
- main.py:12-13 (registration)Initialization of the FastMCP server instance where all @mcp.tool() decorated functions are automatically registered.mcp = FastMCP("Fatebook MCP Server")
- src/fatebook_mcp/__main__.py:12-13 (registration)Initialization of the FastMCP server instance where all @mcp.tool() decorated functions are automatically registered.mcp = FastMCP("Fatebook MCP Server")