MCPcopy Create free account
hub / github.com/coder/coder / TestConnectAll_ToolAllowList

Function TestConnectAll_ToolAllowList

coderd/x/chatd/mcpclient/mcpclient_test.go:139–155  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

137}
138
139func TestConnectAll_ToolAllowList(t *testing.T) {
140 t.Parallel()
141 ctx := context.Background()
142 logger := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true})
143
144 ts := newTestMCPServer(t, echoTool(), greetTool())
145
146 cfg := makeConfig("filtered", ts.URL)
147 // Only allow the "echo" tool.
148 cfg.ToolAllowList = []string{"echo"}
149
150 tools, cleanup := mcpclient.ConnectAll(ctx, logger, []database.MCPServerConfig{cfg}, nil, uuid.Nil, nil, nil)
151 t.Cleanup(cleanup)
152
153 require.Len(t, tools, 1)
154 assert.Equal(t, "filtered__echo", tools[0].Info().Name)
155}
156
157func TestConnectAll_ToolDenyList(t *testing.T) {
158 t.Parallel()

Callers

nothing calls this directly

Calls 9

ConnectAllFunction · 0.92
newTestMCPServerFunction · 0.85
echoToolFunction · 0.85
greetToolFunction · 0.85
makeConfigFunction · 0.85
CleanupMethod · 0.65
LenMethod · 0.45
EqualMethod · 0.45
InfoMethod · 0.45

Tested by

no test coverage detected