| 80 | } |
| 81 | |
| 82 | func createMCPClient(t *testing.T, tempo *e2e.HTTPService) mcpclient.MCPClient { |
| 83 | mcpClient, err := mcpclient.NewStreamableHttpClient("http://" + path.Join(tempo.Endpoint(3200), api.PathMCP)) |
| 84 | require.NoError(t, err) |
| 85 | |
| 86 | // Initialize the connection with required parameters |
| 87 | initReq := mcp.InitializeRequest{ |
| 88 | Params: mcp.InitializeParams{ |
| 89 | ProtocolVersion: mcp.LATEST_PROTOCOL_VERSION, |
| 90 | Capabilities: mcp.ClientCapabilities{}, |
| 91 | ClientInfo: mcp.Implementation{ |
| 92 | Name: "tempo-e2e-test", |
| 93 | Version: "1.0.0", |
| 94 | }, |
| 95 | }, |
| 96 | } |
| 97 | _, err = mcpClient.Initialize(context.Background(), initReq) |
| 98 | if err != nil { |
| 99 | t.Fatalf("failed to initialize MCP client: %v", err) |
| 100 | } |
| 101 | |
| 102 | return mcpClient |
| 103 | } |
| 104 | |
| 105 | func listTools(t *testing.T, mcpClient mcpclient.MCPClient) []mcp.Tool { |
| 106 | toolsResponse, err := mcpClient.ListTools(context.Background(), mcp.ListToolsRequest{}) |