@@ -26,33 +26,38 @@ suite("Roo Code use_mcp_tool Tool", function () {
2626 // Create test files in VSCode workspace directory
2727 const workspaceDir = vscode . workspace . workspaceFolders ?. [ 0 ] ?. uri . fsPath || tempDir
2828
29+ // Resolve the real path to avoid symlink issues on macOS
30+ const realWorkspaceDir = await fs . realpath ( workspaceDir )
31+ console . log ( "Original workspace dir:" , workspaceDir )
32+ console . log ( "Real workspace dir:" , realWorkspaceDir )
33+
2934 // Create test files for MCP filesystem operations
3035 testFiles = {
31- simple : path . join ( workspaceDir , `mcp-test-${ Date . now ( ) } .txt` ) ,
32- testData : path . join ( workspaceDir , `mcp-data-${ Date . now ( ) } .json` ) ,
33- mcpConfig : path . join ( workspaceDir , ".roo" , "mcp.json" ) ,
36+ simple : path . join ( realWorkspaceDir , `mcp-test-${ Date . now ( ) } .txt` ) ,
37+ testData : path . join ( realWorkspaceDir , `mcp-data-${ Date . now ( ) } .json` ) ,
38+ mcpConfig : path . join ( realWorkspaceDir , ".roo" , "mcp.json" ) ,
3439 }
3540
3641 // Create initial test files
3742 await fs . writeFile ( testFiles . simple , "Initial content for MCP test" )
3843 await fs . writeFile ( testFiles . testData , JSON . stringify ( { test : "data" , value : 42 } , null , 2 ) )
3944
4045 // Create .roo directory and MCP configuration file
41- const rooDir = path . join ( workspaceDir , ".roo" )
46+ const rooDir = path . join ( realWorkspaceDir , ".roo" )
4247 await fs . mkdir ( rooDir , { recursive : true } )
4348
4449 const mcpConfig = {
4550 mcpServers : {
4651 filesystem : {
4752 command : "npx" ,
48- args : [ "-y" , "@modelcontextprotocol/server-filesystem" , workspaceDir ] ,
53+ args : [ "-y" , "@modelcontextprotocol/server-filesystem" , realWorkspaceDir ] ,
4954 alwaysAllow : [ ] ,
5055 } ,
5156 } ,
5257 }
5358 await fs . writeFile ( testFiles . mcpConfig , JSON . stringify ( mcpConfig , null , 2 ) )
5459
55- console . log ( "MCP test files created in:" , workspaceDir )
60+ console . log ( "MCP test files created in:" , realWorkspaceDir )
5661 console . log ( "Test files:" , testFiles )
5762 } )
5863
@@ -76,7 +81,8 @@ suite("Roo Code use_mcp_tool Tool", function () {
7681
7782 // Clean up .roo directory
7883 const workspaceDir = vscode . workspace . workspaceFolders ?. [ 0 ] ?. uri . fsPath || tempDir
79- const rooDir = path . join ( workspaceDir , ".roo" )
84+ const realWorkspaceDir = await fs . realpath ( workspaceDir )
85+ const rooDir = path . join ( realWorkspaceDir , ".roo" )
8086 try {
8187 await fs . rm ( rooDir , { recursive : true , force : true } )
8288 } catch {
@@ -353,7 +359,6 @@ suite("Roo Code use_mcp_tool Tool", function () {
353359 }
354360 }
355361 api . on ( "taskCompleted" , taskCompletedHandler )
356- await sleep ( 2000 ) // Wait for Roo Code to fully initialize
357362
358363 // Trigger MCP server detection by opening and modifying the file
359364 console . log ( "Triggering MCP server detection by modifying the config file..." )
@@ -386,7 +391,9 @@ suite("Roo Code use_mcp_tool Tool", function () {
386391 console . error ( "Failed to modify/save MCP config file:" , error )
387392 }
388393
389- await sleep ( 5000 ) // Wait for MCP servers to initialize
394+ // Give MCP servers a moment to be ready (they should already be initialized)
395+ await sleep ( 1000 )
396+
390397 let taskId : string
391398 try {
392399 // Start task requesting to use MCP filesystem write_file tool
@@ -514,7 +521,6 @@ suite("Roo Code use_mcp_tool Tool", function () {
514521 }
515522 }
516523 api . on ( "taskCompleted" , taskCompletedHandler )
517- await sleep ( 2000 ) // Wait for Roo Code to fully initialize
518524
519525 // Trigger MCP server detection by opening and modifying the file
520526 console . log ( "Triggering MCP server detection by modifying the config file..." )
@@ -547,7 +553,9 @@ suite("Roo Code use_mcp_tool Tool", function () {
547553 console . error ( "Failed to modify/save MCP config file:" , error )
548554 }
549555
550- await sleep ( 5000 ) // Wait for MCP servers to initialize
556+ // Give MCP servers a moment to be ready (they should already be initialized)
557+ await sleep ( 1000 )
558+
551559 let taskId : string
552560 try {
553561 // Start task requesting MCP filesystem list_directory tool
@@ -686,7 +694,6 @@ suite("Roo Code use_mcp_tool Tool", function () {
686694 }
687695 }
688696 api . on ( "taskCompleted" , taskCompletedHandler )
689- await sleep ( 2000 ) // Wait for Roo Code to fully initialize
690697
691698 // Trigger MCP server detection by opening and modifying the file
692699 console . log ( "Triggering MCP server detection by modifying the config file..." )
@@ -719,7 +726,9 @@ suite("Roo Code use_mcp_tool Tool", function () {
719726 console . error ( "Failed to modify/save MCP config file:" , error )
720727 }
721728
722- await sleep ( 5000 ) // Wait for MCP servers to initialize
729+ // Give MCP servers a moment to be ready (they should already be initialized)
730+ await sleep ( 1000 )
731+
723732 let taskId : string
724733 try {
725734 // Start task requesting MCP filesystem directory_tree tool
@@ -940,7 +949,8 @@ suite("Roo Code use_mcp_tool Tool", function () {
940949 }
941950 }
942951 api . on ( "taskCompleted" , taskCompletedHandler )
943- await sleep ( 2000 ) // Wait for Roo Code to fully initialize
952+
953+ // Wait for MCP servers to be initialized instead of using sleep
944954
945955 // Trigger MCP server detection by opening and modifying the file
946956 console . log ( "Triggering MCP server detection by modifying the config file..." )
@@ -973,7 +983,9 @@ suite("Roo Code use_mcp_tool Tool", function () {
973983 console . error ( "Failed to modify/save MCP config file:" , error )
974984 }
975985
976- await sleep ( 5000 ) // Wait for MCP servers to initialize
986+ // Give MCP servers a moment to be ready (they should already be initialized)
987+ await sleep ( 1000 )
988+
977989 let taskId : string
978990 try {
979991 // Start task requesting MCP filesystem get_file_info tool
0 commit comments