def tool(self, library: Optional[Union[str, List[str]]] = None):
        """
        Decorator to register a function or class as a tool.
        Can be used as @tool(), @tool("pandas"), or @tool(["pandas", "numpy"])

        Args:
            library: Optional library name or list of library names to install before registering the tool
        """
        def decorator(obj: Union[Callable, Type]):
            # Install libraries first if specified
            if library:
                if isinstance(library, str):
                    self.install_library(library)
                else:
                    for lib in library:
                        self.install_library(lib)
            
            # If it's a class, register each method as a tool
            if isinstance(obj, type):
                class_name = obj.__name__
                
                # Get all methods that don't start with underscore
                methods = [(name, getattr(obj, name)) for name in dir(obj) 
                          if not name.startswith('_') and callable(getattr(obj, name))]
                
                # Register each method as a tool
                for name, method in methods:
                    # Convert the method to a standalone function
                    def create_standalone(method, full_name):
                        if inspect.iscoroutinefunction(method):
                            @wraps(method)
                            async def standalone(*args, **kwargs):
                                return await method(*args, **kwargs)
                        else:
                            @wraps(method)
                            def standalone(*args, **kwargs):
                                return method(*args, **kwargs)
                        standalone.__name__ = full_name
                        return standalone
                    
                    full_name = f"{class_name}__{name}"
                    standalone = create_standalone(method, full_name)
                    self.add_tool(standalone)
                
                return obj
            
            if isinstance(obj, object):
                obj = generate_static_method_class(obj)

                # Get all methods that don't start with underscore
                methods = [(name, getattr(obj, name)) for name in dir(obj) 
                          if not name.startswith('_') and callable(getattr(obj, name))]
                
                # Register each method as a tool
                for name, method in methods:
                    # Convert the method to a standalone function
                    def create_standalone(method, full_name):
                        if inspect.iscoroutinefunction(method):
                            @wraps(method)
                            async def standalone(*args, **kwargs):
                                return await method(*args, **kwargs)
                        else:
                            @wraps(method)
                            def standalone(*args, **kwargs):
                                return method(*args, **kwargs)
                        standalone.__name__ = full_name
                        return standalone
                    
                    full_name = f"{obj.__name__}__{name}"
                    standalone = create_standalone(method, full_name)
                    self.add_tool(standalone)
                
            else:
                # Register the function as a tool
                if inspect.iscoroutinefunction(obj):
                    @wraps(obj)
                    async def wrapper(*args, **kwargs):
                        return await obj(*args, **kwargs)
                else:
                    @wraps(obj)
                    def wrapper(*args, **kwargs):
                        return obj(*args, **kwargs)
                
                self.add_tool(wrapper)
                return wrapper
                
        return decorator

        Decorator to register a function or class as a tool.
        Can be used as @tool(), @tool("pandas"), or @tool(["pandas", "numpy"])

        Args:
            library: Optional library name or list of library names to install before registering the tool
        
src/upsonic/client/tools/tools.py