Files
oai-web/server/tools/__init__.py
2026-04-08 12:43:24 +02:00

51 lines
1.6 KiB
Python

"""
tools/__init__.py — Tool registry factory.
Call build_registry() to get a ToolRegistry populated with all
production tools. The agent loop calls this at startup.
"""
from __future__ import annotations
def build_registry(include_mock: bool = False, is_admin: bool = True):
"""
Build and return a ToolRegistry with all production tools registered.
Args:
include_mock: If True, also register EchoTool and ConfirmTool (for testing).
"""
from ..agent.tool_registry import ToolRegistry
registry = ToolRegistry()
# Production tools — each imported lazily to avoid errors if optional
# dependencies are missing during development
from .brain_tool import BrainTool
from .caldav_tool import CalDAVTool
from .email_tool import EmailTool
from .filesystem_tool import FilesystemTool
from .image_gen_tool import ImageGenTool
from .pushover_tool import PushoverTool
from .telegram_tool import TelegramTool
from .web_tool import WebTool
from .whitelist_tool import WhitelistTool
if is_admin:
from .bash_tool import BashTool
registry.register(BashTool())
registry.register(BrainTool())
registry.register(CalDAVTool())
registry.register(EmailTool())
registry.register(FilesystemTool())
registry.register(ImageGenTool())
registry.register(WebTool())
registry.register(PushoverTool())
registry.register(TelegramTool())
registry.register(WhitelistTool())
if include_mock:
from .mock import ConfirmTool, EchoTool
registry.register(EchoTool())
registry.register(ConfirmTool())
return registry