self-trained2 / agent /tools /registry.py
DeepImagix's picture
Upload 5 files
fb1a676 verified
Raw
History Blame Contribute Delete
1.02 kB
"""
NeuraPrompt Agent — Tool Registry (v7.5)
Central place to register and manage all tools
"""
from typing import Callable, Dict, Any
import logging
log = logging.getLogger("agent.tools.registry")
# This will hold all registered tools
TOOL_REGISTRY: Dict[str, Dict[str, Any]] = {}
def register_tool(name: str, fn: Callable, description: str = ""):
"""Register a new tool"""
TOOL_REGISTRY[name] = {
"fn": fn,
"description": description
}
log.info(f"Registered tool: {name}")
def get_tool(name: str):
"""Get a tool by name"""
return TOOL_REGISTRY.get(name)
def list_tools() -> list:
"""Return list of all registered tools"""
return list(TOOL_REGISTRY.keys())
def get_tool_descriptions() -> str:
"""Return formatted descriptions for the LLM"""
descriptions = []
for name, info in TOOL_REGISTRY.items():
desc = info.get("description", "No description")
descriptions.append(f"- {name}: {desc}")
return "\n".join(descriptions)