Skip to content

Commit ce56830

Browse files
committed
Updates tool descriptions for clarity
Improves the descriptions of the google_search, list_files, read_file, and write_file tools to provide more context and detail about their functionality, security measures, and usage. This enhances understanding and usability. Updates base_dir and relative paths descriptions in file tools.
1 parent 5153106 commit ce56830

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

tests/test_tools_google_search_fixed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def test_name_property(self, google_search_tool):
1515
assert google_search_tool.name == "google_search"
1616

1717
def test_description_property(self, google_search_tool):
18-
expected_description = "Search the web for relevant information."
18+
expected_description = "Perform web searches using Google Custom Search API to retrieve relevant information from the internet. Returns structured search results including titles, URLs, snippets, and metadata. Supports configurable result limits and provides search performance metrics. Requires valid Google API credentials and custom search engine configuration."
1919
assert google_search_tool.description == expected_description
2020

2121
def test_parameters_property(self, google_search_tool):

tests/test_tools_list_files.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class TestListFiles:
77
def test_list_files_properties(self):
88
list_files = ListFiles()
99
assert list_files.name == "list_files"
10-
assert list_files.description == "List files in a specified directory within a secure base directory."
10+
assert list_files.description == "List files and directories within a specified directory path, constrained to operate within a secure base directory for security. Returns comprehensive file listing with metadata including file names, types, and directory structure. Supports recursive directory traversal within security boundaries."
1111

1212
parameters = list_files.parameters
1313
assert parameters["type"] == "object"
@@ -26,7 +26,7 @@ def test_list_files_define_method(self):
2626

2727
assert definition["type"] == "function"
2828
assert definition["function"]["name"] == "list_files"
29-
assert definition["function"]["description"] == "List files in a specified directory within a secure base directory."
29+
assert definition["function"]["description"] == "List files and directories within a specified directory path, constrained to operate within a secure base directory for security. Returns comprehensive file listing with metadata including file names, types, and directory structure. Supports recursive directory traversal within security boundaries."
3030
assert definition["function"]["parameters"]["type"] == "object"
3131

3232
@pytest.mark.asyncio
@@ -122,13 +122,13 @@ def test_list_files_parameters_validation(self):
122122
# Check base_dir parameter
123123
base_dir_prop = params["properties"]["base_dir"]
124124
assert base_dir_prop["type"] == "string"
125-
assert "Base directory" in base_dir_prop["description"]
125+
assert "Absolute path to the base directory" in base_dir_prop["description"]
126126

127127
# Check directory parameter
128128
directory_prop = params["properties"]["directory"]
129129
assert directory_prop["type"] == "string"
130-
assert "relative subdirectory" in directory_prop["description"]
131-
assert "default: '.'" in directory_prop["description"]
130+
assert "Relative path to the subdirectory" in directory_prop["description"]
131+
assert "Defaults to '.'" in directory_prop["description"]
132132

133133
@pytest.mark.asyncio
134134
@patch('libs.fileops.file.FileService')

tests/test_tools_read_file.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class TestReadFile:
77
def test_read_file_properties(self):
88
read_file = ReadFile()
99
assert read_file.name == "read_file"
10-
assert read_file.description == "Read content from a specified file within a secure base directory."
10+
assert read_file.description == "Read and return the complete content of a specified file within security-constrained base directory boundaries. Supports text and binary file reading with proper error handling for missing files, permission issues, and encoding problems. File access is restricted to the specified base directory to prevent path traversal vulnerabilities."
1111

1212
parameters = read_file.parameters
1313
assert parameters["type"] == "object"
@@ -26,7 +26,7 @@ def test_read_file_define_method(self):
2626

2727
assert definition["type"] == "function"
2828
assert definition["function"]["name"] == "read_file"
29-
assert definition["function"]["description"] == "Read content from a specified file within a secure base directory."
29+
assert definition["function"]["description"] == "Read and return the complete content of a specified file within security-constrained base directory boundaries. Supports text and binary file reading with proper error handling for missing files, permission issues, and encoding problems. File access is restricted to the specified base directory to prevent path traversal vulnerabilities."
3030
assert definition["function"]["parameters"]["type"] == "object"
3131

3232
@pytest.mark.asyncio
@@ -120,12 +120,12 @@ def test_read_file_parameters_validation(self):
120120
# Check base_dir parameter
121121
base_dir_prop = params["properties"]["base_dir"]
122122
assert base_dir_prop["type"] == "string"
123-
assert "Base directory" in base_dir_prop["description"]
123+
assert "Absolute path to the base directory" in base_dir_prop["description"]
124124

125125
# Check filename parameter
126126
filename_prop = params["properties"]["filename"]
127127
assert filename_prop["type"] == "string"
128-
assert "relative path" in filename_prop["description"]
128+
assert "Relative path to the target file" in filename_prop["description"]
129129

130130
@pytest.mark.asyncio
131131
@patch('libs.fileops.file.FileService')

tests/test_tools_write_file.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class TestWriteFile:
66
def test_write_file_properties(self):
77
write_file = WriteFile()
88
assert write_file.name == "write_file"
9-
assert write_file.description == "Write content to a specified file within a secure base directory."
9+
assert write_file.description == "Write or overwrite content to a specified file within security-constrained base directory boundaries. Creates directories as needed and handles text encoding automatically. Supports creating new files or updating existing ones with comprehensive error handling for permission issues, disk space, and path validation. File operations are restricted to the specified base directory to prevent path traversal vulnerabilities."
1010

1111
parameters = write_file.parameters
1212
assert parameters["type"] == "object"
@@ -26,7 +26,7 @@ def test_write_file_define_method(self):
2626

2727
assert definition["type"] == "function"
2828
assert definition["function"]["name"] == "write_file"
29-
assert definition["function"]["description"] == "Write content to a specified file within a secure base directory."
29+
assert definition["function"]["description"] == "Write or overwrite content to a specified file within security-constrained base directory boundaries. Creates directories as needed and handles text encoding automatically. Supports creating new files or updating existing ones with comprehensive error handling for permission issues, disk space, and path validation. File operations are restricted to the specified base directory to prevent path traversal vulnerabilities."
3030
assert definition["function"]["parameters"]["type"] == "object"
3131

3232
@pytest.mark.asyncio
@@ -134,12 +134,12 @@ def test_write_file_parameters_validation(self):
134134
# Check base_dir parameter
135135
base_dir_prop = params["properties"]["base_dir"]
136136
assert base_dir_prop["type"] == "string"
137-
assert "Base directory" in base_dir_prop["description"]
137+
assert "Absolute path to the base directory" in base_dir_prop["description"]
138138

139139
# Check filename parameter
140140
filename_prop = params["properties"]["filename"]
141141
assert filename_prop["type"] == "string"
142-
assert "relative path" in filename_prop["description"]
142+
assert "Relative path to the target file" in filename_prop["description"]
143143

144144
# Check content parameter
145145
content_prop = params["properties"]["content"]

0 commit comments

Comments
 (0)