File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,11 @@ import (
2020type MockRootsHandler struct {}
2121
2222func (h * MockRootsHandler ) ListRoots (ctx context.Context , request mcp.ListRootsRequest ) (* mcp.ListRootsResult , error ) {
23- home , _ := os .UserHomeDir ()
23+ home , err := os .UserHomeDir ()
24+ if err != nil {
25+ log .Printf ("Warning: failed to get home directory: %v" , err )
26+ home = "/tmp" // fallback for demonstration
27+ }
2428 app := filepath .ToSlash (filepath .Join (home , "app" ))
2529 proj := filepath .ToSlash (filepath .Join (home , "projects" , "test-project" ))
2630 result := & mcp.ListRootsResult {
Original file line number Diff line number Diff line change @@ -20,7 +20,11 @@ import (
2020type MockRootsHandler struct {}
2121
2222func (h * MockRootsHandler ) ListRoots (ctx context.Context , request mcp.ListRootsRequest ) (* mcp.ListRootsResult , error ) {
23- home , _ := os .UserHomeDir ()
23+ home , err := os .UserHomeDir ()
24+ if err != nil {
25+ log .Printf ("Warning: failed to get home directory: %v" , err )
26+ home = "/tmp" // fallback for demonstration
27+ }
2428 app := filepath .ToSlash (filepath .Join (home , "app" ))
2529 proj := filepath .ToSlash (filepath .Join (home , "projects" , "test-project" ))
2630 result := & mcp.ListRootsResult {
You can’t perform that action at this time.
0 commit comments