Skip to main content
Glama

resolve_question

Mark Fatebook predictions as resolved with YES, NO, or AMBIGUOUS outcomes to track forecast accuracy and update prediction status.

Instructions

Resolve a Fatebook question with YES/NO/AMBIGUOUS resolution

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
questionIdYes
resolutionYes
questionTypeYes
apiKeyNo

Implementation Reference

  • The resolve_question tool handler. Decorated with @mcp.tool(), it validates inputs, calls the Fatebook API to resolve the question, and returns True on success.
    @mcp.tool()
    async def resolve_question(
        questionId: str, resolution: str, questionType: str, apiKey: str = ""
    ) -> bool:
        """Resolve a Fatebook question with YES/NO/AMBIGUOUS resolution"""
    
        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 resolution parameter
        valid_resolutions = ["YES", "NO", "AMBIGUOUS"]
        if resolution not in valid_resolutions:
            raise ValueError(f"resolution must be one of {valid_resolutions}")
    
        data = {
            "questionId": questionId,
            "resolution": resolution,
            "questionType": questionType,
            "apiKey": api_key,
        }
    
        try:
            async with httpx.AsyncClient() as client:
                response = await client.post("https://fatebook.io/api/v0/resolveQuestion", json=data)
                response.raise_for_status()
                return True
    
        except httpx.HTTPError:
            raise
        except Exception:
            raise
  • main.py:153-190 (handler)
    Alternative implementation of resolve_question tool handler in main.py with additional Context logging.
    @mcp.tool()
    async def resolve_question(
        ctx: Context, questionId: str, resolution: str, questionType: str, apiKey: str = ""
    ) -> bool:
        """Resolve a Fatebook question with YES/NO/AMBIGUOUS resolution"""
    
        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)"
            )
    
        # Validate resolution parameter
        valid_resolutions = ["YES", "NO", "AMBIGUOUS"]
        if resolution not in valid_resolutions:
            await ctx.error(f"Invalid resolution parameter: {resolution}")
            raise ValueError(f"resolution must be one of {valid_resolutions}")
    
        data = {
            "questionId": questionId,
            "resolution": resolution,
            "questionType": questionType,
            "apiKey": api_key,
        }
    
        try:
            async with httpx.AsyncClient() as client:
                response = await client.post("https://fatebook.io/api/v0/resolveQuestion", 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

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