from typing import Callable, Dict, Any, List class ToolRegistry: _tools = [] @classmethod def register(cls, name: str, description: str, parameters: Dict[str, Any] = None): def decorator(func: Callable): cls._tools.append({ "type": "function", "function": { "name": name, "description": description, "parameters": parameters or {} } }) # No need for the wrapper since we're not adding any extra logic return func return decorator @classmethod def get_tools(cls, tools: list = None) -> List[Dict[str, Any]]: if tools: return [tool for tool in cls._tools if tool['function']['name'] in tools] else: return cls._tools