"""Tool decorator factory""" from typing import Callable, Any, Dict from luxx.tools.core import ToolDefinition, registry def tool( name: str, description: str, parameters: Dict[str, Any], category: str = "general" ): """ Tool registration decorator Usage: ```python @tool( name="my_tool", description="This is my tool", parameters={ "type": "object", "properties": { "arg1": {"type": "string"} }, "required": ["arg1"] } ) def my_tool(arguments: dict) -> dict: # Implementation... return {"result": "success"} # The tool will be automatically registered ``` """ def decorator(func: Callable) -> Callable: tool_def = ToolDefinition( name=name, description=description, parameters=parameters, handler=func, category=category ) registry.register(tool_def) return func return decorator def tool_function( name: str = None, description: str = None, parameters: Dict[str, Any] = None, category: str = "general" ): """ Alias for tool decorator, providing a more semantic naming """ return tool(name=name, description=description, parameters=parameters, category=category)