Add McpSessions.NegotiatedProtocolVersion property. (#794)

This commit is contained in:
Eirik Tsarpalis 2025-09-19 13:11:01 +03:00 • committed by GitHub
commit 7cfe0ef621
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -171,13 +171,13 @@ public class MapMcpStreamableHttpTests(ITestOutputHelper outputHelper) : MapMcpT
await app.StartAsync(TestContext.Current.CancellationToken);
await using (var mcpClient = await ConnectAsync(clientOptions: new()
await using var mcpClient = await ConnectAsync(clientOptions: new()
{
ProtocolVersion = "2025-03-26",
}))
{
await mcpClient.ListToolsAsync(cancellationToken: TestContext.Current.CancellationToken);
}
});
Assert.Equal("2025-03-26", mcpClient.NegotiatedProtocolVersion);
await mcpClient.ListToolsAsync(cancellationToken: TestContext.Current.CancellationToken);
// The header should be included in the GET request, the initialized notification, the tools/list call, and the delete request.
Assert.NotEmpty(protocolVersionHeaderValues);