Skip to main content
Glama

get_synthesis

Produce a final synthesis of Monte Carlo Tree Search (MCTS) results, enabling comprehensive analysis of topics, questions, or text inputs for decision-making.

Instructions

Generate a final synthesis of the MCTS results

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The primary handler function for the 'get_synthesis' tool. It generates a final comprehensive synthesis using the LLM based on the best MCTS analysis, checks prerequisites, and returns structured results or errors.
    async def get_synthesis() -> dict[str, Any]:
        """
        Generate a final synthesis of the MCTS results.
    
        Creates a comprehensive summary that synthesizes the key insights from the best
        analysis found during the MCTS search process.
    
        Returns:
            Dict containing the synthesis text, best score, and metadata
    
        Raises:
            Exception: If synthesis generation fails or MCTS hasn't been run yet
        """
        if not server_state["initialized"]:
            return {"error": "MCTS not initialized. Call initialize_mcts first.", "status": "error"}
    
        if server_state["best_score"] == 0.0:
            return {"error": "No analysis completed yet. Run run_mcts_search first.", "status": "error"}
    
        try:
            question = server_state["current_question"]
            best_analysis = server_state["best_analysis"]
            best_score = server_state["best_score"]
    
            synthesis_prompt = f"""Create a comprehensive synthesis based on this MCTS analysis:
    
    Original Question: {question}
    
    Best Analysis Found (Score: {best_score}/10):
    {best_analysis}
    
    Provide a final synthesis that:
    1. Summarizes the key insights
    2. Highlights the most important findings
    3. Offers actionable conclusions
    4. Explains why this approach is valuable
    
    Make it clear, comprehensive, and practical."""
    
            synthesis = await call_llm(synthesis_prompt)
    
            return {
                "synthesis": synthesis,
                "best_score": best_score,
                "iterations_completed": server_state["iterations_completed"],
                "question": question,
                "provider": server_state["provider"],
                "model": server_state["model"],
                "status": "success"
            }
    
        except Exception as e:
            logger.error(f"Error generating synthesis: {e}")
            return {"error": f"Synthesis failed: {e!s}", "status": "error"}
  • Registration of the 'get_synthesis' tool in the @server.list_tools() handler, defining its name, description, and empty input schema (no parameters required).
    types.Tool(
        name="get_synthesis",
        description="Generate a final synthesis of the MCTS results",
        inputSchema={"type": "object", "properties": {}}
    ),
  • Input schema for the 'get_synthesis' tool, which is an empty object indicating no input parameters are required.
    inputSchema={"type": "object", "properties": {}}
  • Dispatch logic in the @server.call_tool() handler that routes calls to the get_synthesis function.
    elif name == "get_synthesis":
        result = await get_synthesis()
Install Server

Other Tools

Related Tools

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/angrysky56/mcts-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server