@@ -14,7 +14,7 @@ import (
1414)
1515
1616// MockRootsHandler implements client.RootsHandler for demonstration.
17- // In a real implementation, this would integrate with an actual LLM API .
17+ // In a real implementation, this would enumerate workspace/project roots .
1818type MockRootsHandler struct {}
1919
2020func (h * MockRootsHandler ) ListRoots (ctx context.Context , request mcp.ListRootsRequest ) (* mcp.ListRootsResult , error ) {
@@ -33,9 +33,9 @@ func (h *MockRootsHandler) ListRoots(ctx context.Context, request mcp.ListRootsR
3333 return result , nil
3434}
3535
36- // main starts a mock MCP roots client that communicates with a MCP server over http .
37- // client will call server tool to get the root list. in server tool hander, it will send the list root request to client.
38- // shuts down the client gracefully on SIGINT or SIGTERM.
36+ // main starts a mock MCP roots client over HTTP .
37+ // The server tool triggers a roots/ list request on the client.
38+ // The client shuts down gracefully on SIGINT or SIGTERM.
3939func main () {
4040 // Create roots handler
4141 rootsHandler := & MockRootsHandler {}
@@ -97,7 +97,7 @@ func main() {
9797 // call server tool
9898 request := mcp.CallToolRequest {}
9999 request .Params .Name = "roots"
100- request .Params .Arguments = "{ \ " testonly\ " : \ " yes\" }"
100+ request .Params .Arguments = map [ string ] any { "testonly" : "yes" }
101101 result , err := mcpClient .CallTool (ctx , request )
102102 if err != nil {
103103 log .Fatalf ("failed to call tool roots: %v" , err )
@@ -108,7 +108,7 @@ func main() {
108108 resultStr += fmt .Sprintf ("%s\n " , textContent .Text )
109109 }
110110 }
111- fmt .Printf ("client call tool result: %s" , resultStr )
111+ fmt .Printf ("client call tool result: %s\n " , resultStr )
112112 }
113113
114114 // Keep the client running (in a real app, you'd have your main application logic here)
0 commit comments