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())
