Files
zeekay 5a1c976535 feat: consolidate tools - 52 to 30 tools
Major consolidation of hanzo-mcp tools:

Memory (9 → 1 tool):
- Unified UnifiedMemoryTool with actions: recall, create, update, delete,
  manage, facts, store, summarize, kb

Agent (10+ → 3 tools):
- Unified UnifiedAgentTool for claude, codex, gemini, grok CLI agents
- Removed duplicate critic (use reasoning.critic instead)
- Kept iching and review tools
- Removed code_auth, network, request_clarification

LLM (3 → 2 tools):
- Removed llm_manage (consolidated into llm)

Tool Management (4 → 1 tool):
- Existing unified `tool` command handles install, enable, disable, list

Essential Tools:
- Added memory, shell, open, tool to ESSENTIAL_TOOLS
- Added memory to ESSENTIAL_SYSTEM_TOOLS (always enabled)
- Updated hanzo mode with iching, review, computer

Bug fixes:
- Fixed async await warning in dag_tool.py
- Fixed duplicate critic conflict between agent and reasoning
2025-12-26 11:43:19 -08:00

70 lines
1.6 KiB
Python

"""LLM tools for Hanzo AI.
Tools:
- llm: Unified LLM interface with model management
- consensus: Multi-model consensus
Install:
pip install hanzo-tools-llm[full]
"""
import logging
logger = logging.getLogger(__name__)
# Lazy imports for heavy dependencies
_tools = []
try:
from .llm_unified import UnifiedLLMTool
# Alias for backwards compatibility
LLMTool = UnifiedLLMTool
_tools.append(UnifiedLLMTool)
except ImportError as e:
logger.debug(f"UnifiedLLMTool not available: {e}")
UnifiedLLMTool = None
LLMTool = None
try:
from .consensus_tool import ConsensusTool
_tools.append(ConsensusTool)
except ImportError as e:
logger.debug(f"ConsensusTool not available: {e}")
ConsensusTool = None
TOOLS = _tools
LLM_AVAILABLE = len(_tools) > 0
__all__ = [
"TOOLS",
"LLM_AVAILABLE",
"LLMTool",
"UnifiedLLMTool",
"ConsensusTool",
"register_tools",
]
def register_tools(mcp_server, enabled_tools: dict[str, bool] | None = None):
"""Register LLM tools with MCP server."""
from hanzo_tools.core import ToolRegistry
enabled = enabled_tools or {}
registered = []
for tool_class in TOOLS:
if tool_class is None:
continue
tool_name = getattr(tool_class, "name", tool_class.__name__.lower())
if enabled.get(tool_name, True):
try:
tool = tool_class()
ToolRegistry.register_tool(mcp_server, tool)
registered.append(tool)
except Exception as e:
logger.warning(f"Failed to register {tool_name}: {e}")
return registered