Obsolete Roots, Sampling, and Logging surface area per SEP-2577 (#1651)
Co-authored-by: Tarek Mahmoud Sayed <tarekms@ntdev.microsoft.com>
This commit is contained in:
parent
9b783d7a3b
commit
8ddb3cc36f
7 changed files with 122 additions and 3 deletions
|
|
@ -14,6 +14,7 @@ internal sealed class DestinationBoundMcpServer(McpServerImpl server, ITransport
|
|||
public override Implementation? ClientInfo => server.ClientInfo;
|
||||
public override McpServerOptions ServerOptions => server.ServerOptions;
|
||||
public override IServiceProvider? Services => server.Services;
|
||||
[Obsolete(Obsoletions.DeprecatedLogging_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public override LoggingLevel? LoggingLevel => server.LoggingLevel;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -264,6 +264,7 @@ public sealed class McpRequestFilters
|
|||
/// at or above the specified level to the client as notifications/message notifications.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[Obsolete(Obsoletions.DeprecatedLogging_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public IList<McpRequestFilter<SetLevelRequestParams, EmptyResult>> SetLoggingLevelFilters
|
||||
{
|
||||
get => field ??= [];
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ public abstract partial class McpServer : McpSession
|
|||
/// then returns to <see cref="McpTaskStatus.Working"/> when the response is received.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[Obsolete(Obsoletions.DeprecatedSampling_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public ValueTask<CreateMessageResult> SampleAsync(
|
||||
CreateMessageRequestParams requestParams,
|
||||
CancellationToken cancellationToken = default)
|
||||
|
|
@ -107,6 +108,7 @@ public abstract partial class McpServer : McpSession
|
|||
/// <exception cref="ArgumentNullException"><paramref name="messages"/> is <see langword="null"/>.</exception>
|
||||
/// <exception cref="InvalidOperationException">The client does not support sampling.</exception>
|
||||
/// <exception cref="McpException">The request failed or the client returned an error response.</exception>
|
||||
[Obsolete(Obsoletions.DeprecatedSampling_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public async Task<ChatResponse> SampleAsync(
|
||||
IEnumerable<ChatMessage> messages, ChatOptions? chatOptions = default, JsonSerializerOptions? serializerOptions = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
|
|
@ -243,6 +245,7 @@ public abstract partial class McpServer : McpSession
|
|||
/// <see cref="JsonRpcMessageContext.RelatedTransport"/>, which is always open for the duration of
|
||||
/// the request, rather than relying on the optional standalone GET SSE stream.
|
||||
/// </remarks>
|
||||
[Obsolete(Obsoletions.DeprecatedSampling_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public IChatClient AsSamplingChatClient(JsonSerializerOptions? serializerOptions = null)
|
||||
{
|
||||
ThrowIfSamplingUnsupported();
|
||||
|
|
@ -252,6 +255,7 @@ public abstract partial class McpServer : McpSession
|
|||
|
||||
/// <summary>Gets an <see cref="ILogger"/> on which logged messages will be sent as notifications to the client.</summary>
|
||||
/// <returns>An <see cref="ILogger"/> that can be used to log to the client.</returns>
|
||||
[Obsolete(Obsoletions.DeprecatedLogging_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public ILoggerProvider AsClientLoggerProvider() =>
|
||||
new ClientLoggerProvider(this);
|
||||
|
||||
|
|
@ -271,6 +275,7 @@ public abstract partial class McpServer : McpSession
|
|||
/// <see cref="JsonRpcMessageContext.RelatedTransport"/>, which is always open for the duration of
|
||||
/// the request, rather than relying on the optional standalone GET SSE stream.
|
||||
/// </remarks>
|
||||
[Obsolete(Obsoletions.DeprecatedRoots_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public ValueTask<ListRootsResult> RequestRootsAsync(
|
||||
ListRootsRequestParams requestParams,
|
||||
CancellationToken cancellationToken = default)
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ public abstract partial class McpServer : McpSession
|
|||
public abstract IServiceProvider? Services { get; }
|
||||
|
||||
/// <summary>Gets the last logging level set by the client, or <see langword="null"/> if it's never been set.</summary>
|
||||
[Obsolete(Obsoletions.DeprecatedLogging_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public abstract LoggingLevel? LoggingLevel { get; }
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -199,6 +199,7 @@ public sealed class McpServerHandlers
|
|||
/// at or above the specified level to the client as notifications/message notifications.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[Obsolete(Obsoletions.DeprecatedLogging_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public McpRequestHandler<SetLevelRequestParams, EmptyResult>? SetLoggingLevelHandler { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -169,6 +169,7 @@ internal sealed partial class McpServerImpl : McpServer
|
|||
public override IServiceProvider? Services { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete(Obsoletions.DeprecatedLogging_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public override LoggingLevel? LoggingLevel => _loggingLevel?.Value;
|
||||
|
||||
/// <inheritdoc />
|
||||
|
|
|
|||
|
|
@ -187,6 +187,7 @@ public sealed class McpServerOptions
|
|||
/// This value is used in <see cref="McpServer.SampleAsync(IEnumerable{Microsoft.Extensions.AI.ChatMessage}, Microsoft.Extensions.AI.ChatOptions?, System.Text.Json.JsonSerializerOptions?, CancellationToken)"/>
|
||||
/// when <see cref="Microsoft.Extensions.AI.ChatOptions.MaxOutputTokens"/> is not set in the request options.
|
||||
/// </remarks>
|
||||
[Obsolete(Obsoletions.DeprecatedSampling_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public int MaxSamplingOutputTokens { get; set; } = 1000;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Reference in a new issue