Tool Schema
Step 4: Create the RecycleBinTool
Class
RecycleBinTool
ClassNext, we define the RecycleBinTool
class, which inherits from BaseTool
. This class will implement the logic to perform actions on the recycle bin.
name
: The tool’s name.description
: A brief description of what the tool does.args_schema
: Specifies the schema of input arguments usingRecycleBinArgs
.return_direct
: Set toFalse
, meaning the response will go through the LLM and not directly returned.
Step 5: Implement the _run
Method
_run
MethodThis is the core function where the logic for different actions like clearing the bin, searching files, and restoring files will be implemented.
In this method:
We handle different actions like
clear_bin
,recycle_file
,recycle_all
, andsearch_file
.The appropriate method is called based on the action, and an error message is returned if invalid parameters are provided.
Last updated