47 lines
1022 B
Python
47 lines
1022 B
Python
"""
|
|
NanoClaw Tool System
|
|
|
|
Usage:
|
|
from backend.tools import registry, ToolExecutor, tool
|
|
from backend.tools import init_tools
|
|
|
|
# Initialize built-in tools
|
|
init_tools()
|
|
|
|
# List all tools
|
|
tools = registry.list_all()
|
|
|
|
# Execute a tool
|
|
result = registry.execute("web_search", {"query": "Python"})
|
|
"""
|
|
|
|
from backend.tools.core import ToolDefinition, ToolResult, ToolRegistry, registry
|
|
from backend.tools.factory import tool, register_tool
|
|
from backend.tools.executor import ToolExecutor
|
|
|
|
|
|
def init_tools() -> None:
|
|
"""
|
|
Initialize all built-in tools
|
|
|
|
Importing builtin module automatically registers all decorator-defined tools
|
|
"""
|
|
from backend.tools.builtin import crawler, data, weather, file_ops # noqa: F401
|
|
|
|
|
|
# Public API exports
|
|
__all__ = [
|
|
# Core classes
|
|
"ToolDefinition",
|
|
"ToolResult",
|
|
"ToolRegistry",
|
|
"ToolExecutor",
|
|
# Instances
|
|
"registry",
|
|
# Factory functions
|
|
"tool",
|
|
"register_tool",
|
|
# Initialization
|
|
"init_tools",
|
|
]
|