From 23b2d6b52ec6c604e73e2890e743a6e5dd3f79cc Mon Sep 17 00:00:00 2001 From: Krishna Kumar Date: Wed, 17 Dec 2025 22:02:35 -0600 Subject: [PATCH] Revert "Remove council_query tool to force stage-by-stage usage" This reverts commit 93a70bb195f4f50764ce5d89fc1abd155e1d642a. --- mcp_server/server.py | 50 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/mcp_server/server.py b/mcp_server/server.py index 880814f..2cf40fb 100644 --- a/mcp_server/server.py +++ b/mcp_server/server.py @@ -59,7 +59,55 @@ async def api_request( # ============================================================================ -# INDIVIDUAL STAGE TOOLS (council_query removed to force stage-by-stage usage) +# HIGH-LEVEL COUNCIL TOOL +# ============================================================================ + +@mcp.tool() +async def council_query( + query: str, + conversation_id: str | None = None +) -> dict[str, Any]: + """ + Run the complete LLM Council 3-stage deliberation process. + + Stage 1: Query all council models in parallel for individual responses. + Stage 2: Each model anonymously ranks the other responses. + Stage 3: Chairman model synthesizes a final answer based on all inputs. + + This process typically takes 1-3 minutes depending on model response times. + + Args: + query: The user's question to deliberate on + conversation_id: Optional existing conversation ID for multi-turn context + + Returns: + Complete council response with all 3 stages and metadata including: + - conversation_id: The conversation ID used + - stage1: Individual model responses + - stage2: Peer rankings with aggregate scores + - stage3: Chairman's synthesized final answer + - metadata: Label mappings and aggregate rankings + """ + # Create conversation if not provided + if not conversation_id: + conv = await api_request("POST", "/api/conversations", {}) + conversation_id = conv["id"] + + # Send message and get full council response + result = await api_request( + "POST", + f"/api/conversations/{conversation_id}/message", + {"content": query} + ) + + return { + "conversation_id": conversation_id, + **result + } + + +# ============================================================================ +# INDIVIDUAL STAGE TOOLS # ============================================================================ @mcp.tool()