Files
rag_agent/rag-web-ui/backend/app/tools/registry.py

20 lines
463 B
Python
Raw Normal View History

2026-04-13 11:34:23 +08:00
from typing import Dict, List
from app.tools.base import ToolDefinition
class ToolRegistry:
_tools: Dict[str, ToolDefinition] = {}
@classmethod
def register(cls, definition: ToolDefinition) -> None:
cls._tools[definition.name] = definition
@classmethod
def get(cls, name: str) -> ToolDefinition:
return cls._tools[name]
@classmethod
def list(cls) -> List[ToolDefinition]:
return list(cls._tools.values())