list_directory:The 'list_directory' tool allows users to view the contents of a specified subdirectory within a predefined base directory. It requires a single parameter, 'dir_path', which is a string representing the subdirectory to list. The default value for 'dir_path' is the current directory ('.'). Users must specify 'dir_path' relative to the base directory. If the specified directory does not exist, the tool will return an error message, such as '[Errno 2] No such file or directory'. When successful, the tool returns a structured list of files and directories. Users should be aware of any access constraints or permissions that might limit directory visibility. The tool does not provide absolute paths in its output, so users should ensure the specified 'dir_path' is correct and exists within the base directory. Example usage: To list contents of the 'documents/reports' folder, set 'dir_path' to 'documents/reports'.
copy_file:The 'copy_file' tool allows users to duplicate a file from a specified source path to a designated destination path. This tool operates under strict permission constraints, limiting file operations to the current working directory. Users must ensure that both the source and destination paths are within these permitted directories and that they have the necessary permissions to perform the operation. The tool does not support copying files across different file systems or network locations. It is advisable to verify permissions and directory constraints before using this tool.
write_file:The 'write_file' tool enables users to write text to a file on disk. It requires the following parameters: 'file_path' (a string specifying the name of the file), 'text' (the content to be written to the file), and 'append' (a boolean indicating whether to append to an existing file, defaulting to false). Users must ensure that the 'text' parameter is correctly formatted, with special attention to escaping special characters to prevent errors such as 'EOL while scanning string literal'. Common errors are communicated through an 'error' key in the API response, providing details about the issue encountered. For example, ensure that quotes within the text are properly escaped (e.g., use \\\" for double quotes) and that newlines are correctly represented (e.g., use \\n for new lines). If 'append' is set to true and the file does not exist, the tool will create a new file. Examples of correct usage include providing well-formatted text strings, while incorrect usage might involve unescaped quotes or newlines within the text. Users are advised to understand the default behavior of the 'append' parameter and to anticipate common pitfalls such as improper string formatting.
read_file:The read_file tool allows users to read the contents of a file from disk. It requires a single parameter: the file path. The tool is restricted to accessing files within the current working directory, and attempts to access files outside this directory will result in an 'access denied' error. If the specified file does not exist, the tool will return an error message such as 'Error: no such file or directory'. Permission issues will also result in an appropriate error message. The tool is optimized for reading text files and can efficiently handle large files, such as CSVs with millions of rows. Users should be cautious when reading binary files, as this may lead to encoding issues or unexpected characters. The tool can handle file names with special or international characters, but users should ensure the file path is correctly specified. On successful execution, the tool returns the file content in the response field, with an empty error field. Example usage: To read a file named 'example.txt' in the current directory, use the parameter {'file_path': 'example.txt'}.
move_file:The 'move_file' tool allows you to move or rename a file from one location to another on your system. It requires two parameters: 'source_path', which is the current path of the file you wish to move, and 'destination_path', which is the new path where the file should be moved. Key features include:\n\n1. **Error Handling**: The tool provides error messages for common issues, such as 'no such file or directory' if the source file is not found. It does not support moving symbolic links or shortcuts, which will result in an error.\n\n2. **Network Path Requirements**: Ensure network paths are properly configured and accessible. Network drives must be mounted, and the system must have the necessary permissions.\n\n3. **Permissions and Access**: Read permissions are required on the source path, and write permissions are needed on the destination path.\n\n4. **Overwriting Behavior**: If a file already exists at the destination path, it will be overwritten.\n\n5. **File System Compatibility**: The tool operates within the constraints of the file system it is executed on, including compatibility with network drives and external storage.\n\n6. **Troubleshooting Tips**: Verify path correctness, ensure network drives are connected, and check permissions to resolve common issues.\n\n7. **Limitations**: The tool does not support moving symbolic links or shortcuts. Users should ensure they are specifying actual file paths rather than symbolic links.\n\nThis updated description clarifies the tool's functionalities, requirements, and limitations to help users effectively utilize the tool.
file_delete:The 'file_delete' tool is designed to delete a file at a specified path. It requires a single parameter, 'file_path', which is a string representing the path to the file you wish to delete. If the file does not exist at the specified path, the tool returns an error message in the format 'Error: no such file or directory' followed by the path. This helps users troubleshoot incorrect file paths. It is important to ensure that file paths are correctly formatted, especially in Windows environments where paths should use double backslashes (\\\\) or forward slashes (/) to avoid 'unicodeescape' errors. The tool also provides guidance on resolving issues related to encoding errors or special characters in paths. Including examples of common errors, such as paths with special characters or spaces, and their resolutions can further assist users in effectively utilizing the tool. Note that the tool does not provide detailed error messages beyond indicating that the file or directory could not be found, so users should verify the existence and accessibility of the file at the specified path.
file_search:The 'file_search' tool enables users to recursively search for files within a specified subdirectory that match a given pattern. The search includes all subdirectories within the specified directory. It requires two parameters: 'dir_path', which specifies the subdirectory to search in (default is the current directory '.'), and 'pattern', which is a Unix shell-style wildcard pattern where '*' matches any sequence of characters. Note that the tool does not support brace expansion (e.g., *.{jpg,png,gif}). If no files match the pattern, the tool will return an error message detailing the pattern and directory used. Example usage: To find all PDF files in the 'documents' directory, use the pattern '*.pdf'. For searching multiple file types, use separate patterns such as '*.jpg' and '*.png'.