@@ -22,7 +22,7 @@ async def test_list_tools():
2222 assert len (tools ) == 1
2323 tool = tools [0 ]
2424 assert isinstance (tool , Tool )
25- assert tool .name == "execute "
25+ assert tool .name == "shell_execute "
2626 assert tool .description
2727 assert tool .inputSchema ["type" ] == "object"
2828 assert "command" in tool .inputSchema ["properties" ]
@@ -35,7 +35,7 @@ async def test_list_tools():
3535async def test_call_tool_valid_command (monkeypatch ):
3636 """Test execution of a valid command"""
3737 monkeypatch .setenv ("ALLOW_COMMANDS" , "echo" )
38- result = await call_tool ("execute " , {"command" : ["echo" , "hello world" ]})
38+ result = await call_tool ("shell_execute " , {"command" : ["echo" , "hello world" ]})
3939 assert len (result ) == 1
4040 assert isinstance (result [0 ], TextContent )
4141 assert result [0 ].type == "text"
@@ -46,7 +46,9 @@ async def test_call_tool_valid_command(monkeypatch):
4646async def test_call_tool_with_stdin (monkeypatch ):
4747 """Test command execution with stdin"""
4848 monkeypatch .setenv ("ALLOW_COMMANDS" , "cat" )
49- result = await call_tool ("execute" , {"command" : ["cat" ], "stdin" : "test input" })
49+ result = await call_tool (
50+ "shell_execute" , {"command" : ["cat" ], "stdin" : "test input" }
51+ )
5052 assert len (result ) == 1
5153 assert isinstance (result [0 ], TextContent )
5254 assert result [0 ].type == "text"
@@ -58,7 +60,7 @@ async def test_call_tool_invalid_command(monkeypatch):
5860 """Test execution of an invalid command"""
5961 monkeypatch .setenv ("ALLOW_COMMANDS" , "echo" )
6062 with pytest .raises (RuntimeError ) as excinfo :
61- await call_tool ("execute " , {"command" : ["invalid_command" ]})
63+ await call_tool ("shell_execute " , {"command" : ["invalid_command" ]})
6264 assert "Command not allowed: invalid_command" in str (excinfo .value )
6365
6466
@@ -74,15 +76,15 @@ async def test_call_tool_unknown_tool():
7476async def test_call_tool_invalid_arguments ():
7577 """Test calling a tool with invalid arguments"""
7678 with pytest .raises (RuntimeError ) as excinfo :
77- await call_tool ("execute " , "not a dict" )
79+ await call_tool ("shell_execute " , "not a dict" )
7880 assert "Arguments must be a dictionary" in str (excinfo .value )
7981
8082
8183@pytest .mark .asyncio
8284async def test_call_tool_empty_command ():
8385 """Test execution with empty command"""
8486 with pytest .raises (RuntimeError ) as excinfo :
85- await call_tool ("execute " , {"command" : []})
87+ await call_tool ("shell_execute " , {"command" : []})
8688 assert "No command provided" in str (excinfo .value )
8789
8890
@@ -92,7 +94,7 @@ async def test_call_tool_with_directory(temp_test_dir, monkeypatch):
9294 """Test command execution in a specific directory"""
9395 monkeypatch .setenv ("ALLOW_COMMANDS" , "pwd" )
9496 result = await call_tool (
95- "execute " , {"command" : ["pwd" ], "directory" : temp_test_dir }
97+ "shell_execute " , {"command" : ["pwd" ], "directory" : temp_test_dir }
9698 )
9799 assert len (result ) == 1
98100 assert isinstance (result [0 ], TextContent )
@@ -111,13 +113,17 @@ async def test_call_tool_with_file_operations(temp_test_dir, monkeypatch):
111113 f .write ("test content" )
112114
113115 # Test ls command
114- result = await call_tool ("execute" , {"command" : ["ls" ], "directory" : temp_test_dir })
116+ result = await call_tool (
117+ "shell_execute" , {"command" : ["ls" ], "directory" : temp_test_dir }
118+ )
119+ assert isinstance (result [0 ], TextContent )
115120 assert "test.txt" in result [0 ].text
116121
117122 # Test cat command
118123 result = await call_tool (
119- "execute " , {"command" : ["cat" , "test.txt" ], "directory" : temp_test_dir }
124+ "shell_execute " , {"command" : ["cat" , "test.txt" ], "directory" : temp_test_dir }
120125 )
126+ assert isinstance (result [0 ], TextContent )
121127 assert result [0 ].text .strip () == "test content"
122128
123129
@@ -127,7 +133,7 @@ async def test_call_tool_with_nonexistent_directory(monkeypatch):
127133 monkeypatch .setenv ("ALLOW_COMMANDS" , "ls" )
128134 with pytest .raises (RuntimeError ) as excinfo :
129135 await call_tool (
130- "execute " , {"command" : ["ls" ], "directory" : "/nonexistent/directory" }
136+ "shell_execute " , {"command" : ["ls" ], "directory" : "/nonexistent/directory" }
131137 )
132138 assert "Directory does not exist: /nonexistent/directory" in str (excinfo .value )
133139
@@ -143,7 +149,7 @@ async def test_call_tool_with_file_as_directory(temp_test_dir, monkeypatch):
143149 f .write ("test content" )
144150
145151 with pytest .raises (RuntimeError ) as excinfo :
146- await call_tool ("execute " , {"command" : ["ls" ], "directory" : test_file })
152+ await call_tool ("shell_execute " , {"command" : ["ls" ], "directory" : test_file })
147153 assert f"Not a directory: { test_file } " in str (excinfo .value )
148154
149155
@@ -157,5 +163,8 @@ async def test_call_tool_with_nested_directory(temp_test_dir, monkeypatch):
157163 os .mkdir (nested_dir )
158164 nested_real_path = os .path .realpath (nested_dir )
159165
160- result = await call_tool ("execute" , {"command" : ["pwd" ], "directory" : nested_dir })
166+ result = await call_tool (
167+ "shell_execute" , {"command" : ["pwd" ], "directory" : nested_dir }
168+ )
169+ assert isinstance (result [0 ], TextContent )
161170 assert result [0 ].text .strip () == nested_real_path
0 commit comments