(t *testing.T)
| 114 | } |
| 115 | |
| 116 | func TestConnectAll_CallTool(t *testing.T) { |
| 117 | t.Parallel() |
| 118 | ctx := context.Background() |
| 119 | logger := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true}) |
| 120 | |
| 121 | ts := newTestMCPServer(t, echoTool()) |
| 122 | |
| 123 | cfg := makeConfig("srv", ts.URL) |
| 124 | tools, cleanup := mcpclient.ConnectAll(ctx, logger, []database.MCPServerConfig{cfg}, nil, uuid.Nil, nil, nil) |
| 125 | t.Cleanup(cleanup) |
| 126 | require.Len(t, tools, 1) |
| 127 | |
| 128 | tool := tools[0] |
| 129 | resp, err := tool.Run(ctx, fantasy.ToolCall{ |
| 130 | ID: "call-1", |
| 131 | Name: "srv__echo", |
| 132 | Input: `{"input":"hello world"}`, |
| 133 | }) |
| 134 | require.NoError(t, err) |
| 135 | assert.False(t, resp.IsError) |
| 136 | assert.Equal(t, "echo: hello world", resp.Content) |
| 137 | } |
| 138 | |
| 139 | func TestConnectAll_ToolAllowList(t *testing.T) { |
| 140 | t.Parallel() |
nothing calls this directly
no test coverage detected