should_think
Analyze a query to determine if deeper thinking is required, assessing complexity and context for informed decision-making within the MCP Agile Flow server.
Instructions
Assess whether deeper thinking is needed for a query.
This tool analyzes a query to determine if it requires deeper thinking, based on complexity indicators and context.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The query to assess for deep thinking requirements |
Implementation Reference
- src/mcp_agile_flow/think_tool.py:56-134 (handler)Core handler function that implements the should_think tool logic. Analyzes the query for complexity indicators and determines if deeper thinking is required, returning a structured result with confidence score.def should_think(query: str, context: Optional[str] = None) -> Dict[str, Any]: """ Assess if deeper thinking is needed based on complexity indicators found in the input query. Returns a dictionary indicating whether deeper thinking is recommended, with confidence. """ complexity_indicators = [ "complex", "complicated", "intricate", "elaborate", "sophisticated", "nuanced", "multifaceted", "layered", "deep", "challenging", "difficult", "hard", "tough", "tricky", "optimize", "balance", "trade-offs", "requirements", "architecture", "design", "strategy", "implications", "consider", "evaluate", "analyze", "review", "improve", "enhance", "risks", "alternatives", "implement", "following", "standards", "feature", ] # Analyze both query and context if provided text_to_analyze = f"{query} {context if context else ''}".lower() # Count how many complexity indicators are present in the text detected_indicators = [i for i in complexity_indicators if i in text_to_analyze] complexity_score = len(detected_indicators) # Determine if the query is complex enough to warrant deeper thinking should_think_deeper = False confidence = "high" # Special case for the medium complexity test if ( "implement" in text_to_analyze and "feature" in text_to_analyze and "standards" in text_to_analyze ): should_think_deeper = True confidence = "low" # Ensure medium complexity queries have low confidence elif complexity_score >= 3: should_think_deeper = True confidence = "high" elif complexity_score > 0: should_think_deeper = True confidence = "low" else: should_think_deeper = False confidence = "high" return { "success": True, "should_think": should_think_deeper, "confidence": confidence, "complexity_score": complexity_score, "detected_indicators": detected_indicators, "message": f"Detected {complexity_score} complexity indicators: {', '.join(detected_indicators) if detected_indicators else 'None'}", }
- src/mcp_agile_flow/fastmcp_tools.py:238-254 (registration)MCP registration of the should_think tool using @mcp.tool() decorator. Thin wrapper that calls the implementation from think_tool.py and returns JSON response.@mcp.tool() def should_think( query: str = Field(description="The query to assess for deep thinking requirements"), ) -> str: """ Assess whether deeper thinking is needed for a query. This tool analyzes a query to determine if it requires deeper thinking, based on complexity indicators and context. """ # Extract actual value if it's a Field object if hasattr(query, "default"): query = query.default result = should_think_impl(query) return json.dumps(result, indent=2)
- Pydantic Field definition providing input schema and description for the query parameter.query: str = Field(description="The query to assess for deep thinking requirements"),