clear_thoughts
Remove recorded thoughts from the MCP Agile Flow server, optionally filtered by category. Helps manage and streamline AI-assisted agile development workflows.
Instructions
Clear recorded thoughts.
This tool removes previously recorded thoughts, optionally filtered by category. If no category is specified, all thoughts will be cleared.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | No | Filter to clear thoughts from a specific category only |
Implementation Reference
- src/mcp_agile_flow/think_tool.py:240-253 (handler)Primary handler function that clears thoughts from the global ThoughtStorage instance, computes the number cleared, and returns a success response with details.
def clear_thoughts(category: Optional[str] = None) -> Dict[str, Any]: """Clear recorded thoughts.""" count_before = len(_storage.get_thoughts()) _storage.clear_thoughts(category) count_after = len(_storage.get_thoughts()) count_cleared = count_before - count_after message = f"Cleared {count_cleared} recorded thoughts" if category: message += f" in category '{category}'." else: message += "." return {"success": True, "message": message, "thoughts_cleared": count_cleared} - src/mcp_agile_flow/fastmcp_tools.py:180-198 (registration)MCP tool registration using @mcp.tool() decorator. Includes input schema definition via pydantic Field for the optional 'category' parameter. Delegates execution to the imported clear_thoughts_impl and serializes the result to JSON.
@mcp.tool() def clear_thoughts( category: Optional[str] = Field( description="Filter to clear thoughts from a specific category only", default=None ), ) -> str: """ Clear recorded thoughts. This tool removes previously recorded thoughts, optionally filtered by category. If no category is specified, all thoughts will be cleared. """ # Extract actual value if it's a Field object if hasattr(category, "default"): category = category.default result = clear_thoughts_impl(category) return json.dumps(result, indent=2) - Pydantic Field definition providing input schema/validation and description for the 'category' parameter of the clear_thoughts tool.
category: Optional[str] = Field( description="Filter to clear thoughts from a specific category only", default=None ), ) -> str: - Helper method in ThoughtStorage class that performs the actual clearing/filtering of thoughts list in memory and persists to temporary JSON file.
def clear_thoughts(self, category: Optional[str] = None): """Clear stored thoughts, optionally by category.""" if category: self._thoughts = [t for t in self._thoughts if t.get("category") != category] else: self._thoughts = [] self._save()