(t *testing.T)
| 24 | ) |
| 25 | |
| 26 | func newInProcessClient(t *testing.T) *client.Client { |
| 27 | t.Helper() |
| 28 | cfg := DefaultConfig() |
| 29 | srv := New(cfg) |
| 30 | |
| 31 | c, err := client.NewInProcessClient(srv.mcpSrv) |
| 32 | if err != nil { |
| 33 | t.Fatalf("NewInProcessClient: %v", err) |
| 34 | } |
| 35 | |
| 36 | ctx := context.Background() |
| 37 | if err := c.Start(ctx); err != nil { |
| 38 | t.Fatalf("client.Start: %v", err) |
| 39 | } |
| 40 | |
| 41 | initReq := mcpmcp.InitializeRequest{} |
| 42 | initReq.Params.ProtocolVersion = mcpmcp.LATEST_PROTOCOL_VERSION |
| 43 | initReq.Params.ClientInfo = mcpmcp.Implementation{ |
| 44 | Name: "gosqlx-test-client", |
| 45 | Version: "0.0.1", |
| 46 | } |
| 47 | _, err = c.Initialize(ctx, initReq) |
| 48 | if err != nil { |
| 49 | t.Fatalf("client.Initialize: %v", err) |
| 50 | } |
| 51 | |
| 52 | t.Cleanup(func() { _ = c.Close() }) |
| 53 | return c |
| 54 | } |
| 55 | |
| 56 | func extractProtocolResult(t *testing.T, res *mcpmcp.CallToolResult) map[string]any { |
| 57 | t.Helper() |
no test coverage detected