detect_thinking_directive
Analyze text to identify directives prompting deeper thinking, such as 'think harder' or 'think again', within MCP Agile Flow workflows.
Instructions
Detect thinking directives.
This tool analyzes text to detect directives suggesting deeper thinking, such as "think harder", "think deeper", "think again", etc.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | The text to analyze for thinking directives |
Implementation Reference
- MCP handler function decorated with @mcp.tool(). It extracts the input text, calls the core implementation (detect_thinking_directive_impl), and returns the result as JSON string. Includes input schema via Pydantic Field.@mcp.tool() def detect_thinking_directive( text: str = Field(description="The text to analyze for thinking directives"), ) -> str: """ Detect thinking directives. This tool analyzes text to detect directives suggesting deeper thinking, such as "think harder", "think deeper", "think again", etc. """ # Extract actual value if it's a Field object if hasattr(text, "default"): text = text.default result = detect_thinking_directive_impl(text) return json.dumps(result, indent=2)
- Core helper function implementing the detection logic. Checks for specific phrases indicating thinking directives (deeper, harder, again, more) in the input text and returns detection results with type and confidence.def detect_thinking_directive(text: str) -> Dict[str, Any]: """Detect if text contains a directive to think more deeply.""" directives = { "deeper": ["think deeper", "think more deeply", "dive deeper"], "harder": ["think harder", "think more carefully"], "again": [ "think again", "rethink", "consider again", "think about this again", "think about it again", ], "more": ["think more", "more thoughts", "additional thoughts"], } text = text.lower() for directive_type, phrases in directives.items(): if any(phrase in text for phrase in phrases): return { "detected": True, "directive_type": directive_type, "confidence": "medium", # All directives have medium confidence "message": f"Detected '{directive_type}' thinking directive", } return { "detected": False, "directive_type": None, "confidence": "low", "message": "No thinking directive detected", }
- src/mcp_agile_flow/fastmcp_tools.py:26-26 (registration)Import of the core implementation function aliased as detect_thinking_directive_impl, used by the handler.from .think_tool import detect_thinking_directive as detect_thinking_directive_impl
- Pydantic input schema definition for the 'text' parameter using Field with description.text: str = Field(description="The text to analyze for thinking directives"),