# Tool Schema

#### Step 4: Create the `RecycleBinTool` Class

Next, we define the `RecycleBinTool` class, which inherits from `BaseTool`. This class will implement the logic to perform actions on the recycle bin.

```python
class RecycleBinTool(BaseTool):
    name: str = "recycle_bin"
    description: str = "Clear the recycle bin or recycle a specific file or all files."
    args_schema: Optional[Type[BaseModel]] = RecycleBinArgs
    return_direct: Optional[bool] = False
```

* **`name`**: The tool’s name.
* **`description`**: A brief description of what the tool does.
* **`args_schema`**: Specifies the schema of input arguments using `RecycleBinArgs`.
* **`return_direct`**: Set to `False`, meaning the response will go through the LLM and not directly returned.

#### Step 5: Implement the `_run` Method

This is the core function where the logic for different actions like clearing the bin, searching files, and restoring files will be implemented.

```python
def _run(self, action: str, file_name: Optional[str] = None, file_path: Optional[str] = None) -> str:
    try:
        if action == "clear_bin":
            return self.clear_bin()
        elif action == "recycle_file" and file_path:
            return self.recycle_file(file_path)
        elif action == "recycle_all":
            return self.recycle_all()
        elif action == "search_file" and file_name:
            return self.search_file(file_name)
        else:
            return "Error: Invalid action or missing parameters."
    except Exception as e:
        return f"Error: {str(e)}"
```

In this method:

* We handle different actions like `clear_bin`, `recycle_file`, `recycle_all`, and `search_file`.
* The appropriate method is called based on the action, and an error message is returned if invalid parameters are provided.
