Add McpSessions.NegotiatedProtocolVersion property. (#794)
This commit is contained in:
parent
38b4a26998
commit
7cfe0ef621
1 changed files with 57 additions and 20 deletions
|
|
@ -26,6 +26,7 @@ internal sealed partial class McpClientImpl : McpClient
|
|||
private ServerCapabilities? _serverCapabilities;
|
||||
private Implementation? _serverInfo;
|
||||
private string? _serverInstructions;
|
||||
private string? _negotiatedProtocolVersion;
|
||||
|
||||
private bool _disposed;
|
||||
|
||||
|
|
@ -112,6 +113,9 @@ internal sealed partial class McpClientImpl : McpClient
|
|||
/// <inheritdoc/>
|
||||
public override string? SessionId => _transport.SessionId;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string? NegotiatedProtocolVersion => _negotiatedProtocolVersion;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override ServerCapabilities ServerCapabilities => _serverCapabilities ?? throw new InvalidOperationException("The client is not connected.");
|
||||
|
||||
|
|
@ -177,6 +181,8 @@ internal sealed partial class McpClientImpl : McpClient
|
|||
throw new McpException($"Server protocol version mismatch. Expected {requestProtocol}, got {initializeResponse.ProtocolVersion}");
|
||||
}
|
||||
|
||||
_negotiatedProtocolVersion = initializeResponse.ProtocolVersion;
|
||||
|
||||
// Send initialized notification
|
||||
await this.SendNotificationAsync(
|
||||
NotificationMethods.InitializedNotification,
|
||||
|
|
|
|||
Loading…
Reference in a new issue