(t *testing.T)
| 89 | } |
| 90 | |
| 91 | func TestConnectAll_DiscoverTools(t *testing.T) { |
| 92 | t.Parallel() |
| 93 | ctx := context.Background() |
| 94 | logger := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true}) |
| 95 | |
| 96 | ts := newTestMCPServer(t, echoTool(), greetTool()) |
| 97 | |
| 98 | cfg := makeConfig("myserver", ts.URL) |
| 99 | tools, cleanup := mcpclient.ConnectAll(ctx, logger, []database.MCPServerConfig{cfg}, nil, uuid.Nil, nil, nil) |
| 100 | t.Cleanup(cleanup) |
| 101 | |
| 102 | // Two tools should be discovered, namespaced with the server slug. |
| 103 | require.Len(t, tools, 2) |
| 104 | |
| 105 | names := toolNames(tools) |
| 106 | assert.Contains(t, names, "myserver__echo") |
| 107 | assert.Contains(t, names, "myserver__greet") |
| 108 | |
| 109 | // Verify the description is preserved. |
| 110 | foundEcho := findTool(tools, "myserver__echo") |
| 111 | require.NotNilf(t, foundEcho, "expected to find myserver__echo") |
| 112 | echoInfo := foundEcho.Info() |
| 113 | assert.Equal(t, "Echoes the input", echoInfo.Description) |
| 114 | } |
| 115 | |
| 116 | func TestConnectAll_CallTool(t *testing.T) { |
| 117 | t.Parallel() |
nothing calls this directly
no test coverage detected