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
26 changed files with 122 additions and 3 deletions
|
|
@ -52,6 +52,7 @@ public sealed class ClientCapabilities
|
|||
/// </para>
|
||||
/// </remarks>
|
||||
[JsonPropertyName("roots")]
|
||||
[Obsolete(Obsoletions.DeprecatedRoots_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public RootsCapability? Roots { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -59,6 +60,7 @@ public sealed class ClientCapabilities
|
|||
/// supports issuing requests to an LLM on behalf of the server.
|
||||
/// </summary>
|
||||
[JsonPropertyName("sampling")]
|
||||
[Obsolete(Obsoletions.DeprecatedSampling_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public SamplingCapability? Sampling { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -760,6 +760,9 @@ public sealed class ResourceLinkBlock : ContentBlock
|
|||
|
||||
/// <summary>Represents a request from the assistant to call a tool.</summary>
|
||||
[DebuggerDisplay("Name = {Name}, Id = {Id}")]
|
||||
// Sampling support type: this content block only appears inside sampling messages (an assistant tool call),
|
||||
// so it is deprecated together with sampling per SEP-2577.
|
||||
[Obsolete(Obsoletions.DeprecatedSampling_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public sealed class ToolUseContentBlock : ContentBlock
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
|
|
@ -789,6 +792,9 @@ public sealed class ToolUseContentBlock : ContentBlock
|
|||
|
||||
/// <summary>Represents the result of a tool use, provided by the user back to the assistant.</summary>
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
// Sampling support type: this content block only appears inside sampling messages (a tool result returned to
|
||||
// the assistant), so it is deprecated together with sampling per SEP-2577.
|
||||
[Obsolete(Obsoletions.DeprecatedSampling_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public sealed class ToolResultContentBlock : ContentBlock
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ namespace ModelContextProtocol.Protocol;
|
|||
/// </para>
|
||||
/// </remarks>
|
||||
[JsonConverter(typeof(JsonStringEnumConverter<ContextInclusion>))]
|
||||
// Sampling support type: only used to select what context to include on sampling (createMessage) requests,
|
||||
// so it is deprecated together with sampling per SEP-2577.
|
||||
[Obsolete(Obsoletions.DeprecatedSampling_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public enum ContextInclusion
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@ namespace ModelContextProtocol.Protocol;
|
|||
/// <remarks>
|
||||
/// See the <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">schema</see> for details.
|
||||
/// </remarks>
|
||||
// Sampling support type: "createMessage" is the sampling request, so this is deprecated together with
|
||||
// sampling per SEP-2577.
|
||||
[Obsolete(Obsoletions.DeprecatedSampling_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public sealed class CreateMessageRequestParams : RequestParams
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@ namespace ModelContextProtocol.Protocol;
|
|||
/// <remarks>
|
||||
/// See the <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">schema</see> for details.
|
||||
/// </remarks>
|
||||
// Sampling support type: "createMessage" is the sampling request, so this result is deprecated together
|
||||
// with sampling per SEP-2577.
|
||||
[Obsolete(Obsoletions.DeprecatedSampling_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public sealed class CreateMessageResult : Result
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ public sealed class InputRequest
|
|||
/// </summary>
|
||||
/// <returns>The deserialized sampling parameters, or <see langword="null"/> if the method does not match or params are absent.</returns>
|
||||
[JsonIgnore]
|
||||
[Obsolete(Obsoletions.DeprecatedSampling_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public CreateMessageRequestParams? SamplingParams =>
|
||||
string.Equals(Method, RequestMethods.SamplingCreateMessage, StringComparison.Ordinal) && Params is { } p
|
||||
? JsonSerializer.Deserialize(p, McpJsonUtilities.JsonContext.Default.CreateMessageRequestParams)
|
||||
|
|
@ -76,6 +77,7 @@ public sealed class InputRequest
|
|||
/// </summary>
|
||||
/// <returns>The deserialized roots list parameters, or <see langword="null"/> if the method does not match or params are absent.</returns>
|
||||
[JsonIgnore]
|
||||
[Obsolete(Obsoletions.DeprecatedRoots_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public ListRootsRequestParams? RootsParams =>
|
||||
string.Equals(Method, RequestMethods.RootsList, StringComparison.Ordinal) && Params is { } p
|
||||
? JsonSerializer.Deserialize(p, McpJsonUtilities.JsonContext.Default.ListRootsRequestParams)
|
||||
|
|
@ -86,6 +88,7 @@ public sealed class InputRequest
|
|||
/// </summary>
|
||||
/// <param name="requestParams">The sampling request parameters.</param>
|
||||
/// <returns>A new <see cref="InputRequest"/> instance.</returns>
|
||||
[Obsolete(Obsoletions.DeprecatedSampling_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public static InputRequest ForSampling(CreateMessageRequestParams requestParams)
|
||||
{
|
||||
Throw.IfNull(requestParams);
|
||||
|
|
@ -116,6 +119,7 @@ public sealed class InputRequest
|
|||
/// </summary>
|
||||
/// <param name="requestParams">The roots list request parameters.</param>
|
||||
/// <returns>A new <see cref="InputRequest"/> instance.</returns>
|
||||
[Obsolete(Obsoletions.DeprecatedRoots_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public static InputRequest ForRootsList(ListRootsRequestParams requestParams)
|
||||
{
|
||||
Throw.IfNull(requestParams);
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ public sealed class InputResponse
|
|||
/// <see cref="Deserialize{T}"/> when the corresponding <see cref="InputRequest.Method"/> is
|
||||
/// <see cref="RequestMethods.SamplingCreateMessage"/>.
|
||||
/// </summary>
|
||||
[Obsolete(Obsoletions.DeprecatedSampling_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public static JsonTypeInfo<CreateMessageResult> CreateMessageResultJsonTypeInfo => McpJsonUtilities.JsonContext.Default.CreateMessageResult;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -65,6 +66,7 @@ public sealed class InputResponse
|
|||
/// <see cref="Deserialize{T}"/> when the corresponding <see cref="InputRequest.Method"/> is
|
||||
/// <see cref="RequestMethods.RootsList"/>.
|
||||
/// </summary>
|
||||
[Obsolete(Obsoletions.DeprecatedRoots_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public static JsonTypeInfo<ListRootsResult> ListRootsResultJsonTypeInfo => McpJsonUtilities.JsonContext.Default.ListRootsResult;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -72,6 +74,7 @@ public sealed class InputResponse
|
|||
/// </summary>
|
||||
/// <param name="result">The sampling result.</param>
|
||||
/// <returns>A new <see cref="InputResponse"/> instance.</returns>
|
||||
[Obsolete(Obsoletions.DeprecatedSampling_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public static InputResponse FromSamplingResult(CreateMessageResult result)
|
||||
{
|
||||
Throw.IfNull(result);
|
||||
|
|
@ -100,6 +103,7 @@ public sealed class InputResponse
|
|||
/// </summary>
|
||||
/// <param name="result">The roots list result.</param>
|
||||
/// <returns>A new <see cref="InputResponse"/> instance.</returns>
|
||||
[Obsolete(Obsoletions.DeprecatedRoots_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public static InputResponse FromRootsResult(ListRootsResult result)
|
||||
{
|
||||
Throw.IfNull(result);
|
||||
|
|
|
|||
|
|
@ -8,4 +8,5 @@ namespace ModelContextProtocol.Protocol;
|
|||
/// The client responds with a <see cref="ListRootsResult"/> containing the client's roots.
|
||||
/// See the <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">schema</see> for details.
|
||||
/// </remarks>
|
||||
[Obsolete(Obsoletions.DeprecatedRoots_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public sealed class ListRootsRequestParams : RequestParams;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ namespace ModelContextProtocol.Protocol;
|
|||
/// See the <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">schema</see> for details.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[Obsolete(Obsoletions.DeprecatedRoots_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public sealed class ListRootsResult : Result
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ namespace ModelContextProtocol.Protocol;
|
|||
/// specification may extend this capability with additional configuration options.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[Obsolete(Obsoletions.DeprecatedLogging_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public sealed class LoggingCapability
|
||||
{
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Text.Json.Serialization;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace ModelContextProtocol.Protocol;
|
||||
|
||||
|
|
@ -9,6 +9,7 @@ namespace ModelContextProtocol.Protocol;
|
|||
/// These values map to syslog message severities, as specified in <see href="https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1">RFC-5424</see>.
|
||||
/// </remarks>
|
||||
[JsonConverter(typeof(JsonStringEnumConverter<LoggingLevel>))]
|
||||
[Obsolete(Obsoletions.DeprecatedLogging_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public enum LoggingLevel
|
||||
{
|
||||
/// <summary>Detailed debug information, typically only valuable to developers.</summary>
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ namespace ModelContextProtocol.Protocol;
|
|||
/// See the <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">schema</see> for details.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[Obsolete(Obsoletions.DeprecatedLogging_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public sealed class LoggingMessageNotificationParams : NotificationParams
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@ namespace ModelContextProtocol.Protocol;
|
|||
/// See the <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">schema</see> for details.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
// Sampling support type: only used inside ModelPreferences to hint a model for sampling (createMessage)
|
||||
// requests, so it is deprecated together with sampling per SEP-2577.
|
||||
[Obsolete(Obsoletions.DeprecatedSampling_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public sealed class ModelHint
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@ namespace ModelContextProtocol.Protocol;
|
|||
/// See the <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">schema</see> for details.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
// Sampling support type: only used to express model selection preferences on sampling (createMessage)
|
||||
// requests, so it is deprecated together with sampling per SEP-2577.
|
||||
[Obsolete(Obsoletions.DeprecatedSampling_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public sealed class ModelPreferences
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ public static class NotificationMethods
|
|||
/// method to get the updated list of roots from the client.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[Obsolete(Obsoletions.DeprecatedRoots_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public const string RootsListChangedNotification = "notifications/roots/list_changed";
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -80,6 +81,7 @@ public static class NotificationMethods
|
|||
/// the server can determine which messages to send based on its own configuration.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[Obsolete(Obsoletions.DeprecatedLogging_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public const string LoggingMessageNotification = "notifications/message";
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ public static class RequestMethods
|
|||
/// <summary>
|
||||
/// The name of the request method sent from the server to request a list of the client's roots.
|
||||
/// </summary>
|
||||
[Obsolete(Obsoletions.DeprecatedRoots_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public const string RootsList = "roots/list";
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -71,6 +72,7 @@ public static class RequestMethods
|
|||
/// send log messages with severity at or above the specified level to the client as
|
||||
/// <see cref="NotificationMethods.LoggingMessageNotification"/> notifications.
|
||||
/// </remarks>
|
||||
[Obsolete(Obsoletions.DeprecatedLogging_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public const string LoggingSetLevel = "logging/setLevel";
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -91,6 +93,7 @@ public static class RequestMethods
|
|||
/// based on provided messages. It is part of the sampling capability in the Model Context Protocol and enables servers to access
|
||||
/// client-side AI models without needing direct API access to those models.
|
||||
/// </remarks>
|
||||
[Obsolete(Obsoletions.DeprecatedSampling_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public const string SamplingCreateMessage = "sampling/createMessage";
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ namespace ModelContextProtocol.Protocol;
|
|||
/// guidance rather than an access-control mechanism. Each root has a URI that uniquely identifies
|
||||
/// it and optional metadata like a human-readable name.
|
||||
/// </remarks>
|
||||
[Obsolete(Obsoletions.DeprecatedRoots_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public sealed class Root
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ namespace ModelContextProtocol.Protocol;
|
|||
/// See the <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">schema</see> for details.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[Obsolete(Obsoletions.DeprecatedRoots_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public sealed class RootsCapability
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -12,4 +12,5 @@ namespace ModelContextProtocol.Protocol;
|
|||
/// See the <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">schema</see> for details.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[Obsolete(Obsoletions.DeprecatedRoots_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public sealed class RootsListChangedNotificationParams : NotificationParams;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ namespace ModelContextProtocol.Protocol;
|
|||
/// using an AI model. The client must set a <see cref="McpClientHandlers.SamplingHandler"/> to process these requests.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[Obsolete(Obsoletions.DeprecatedSampling_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
|
||||
public sealed class SamplingCapability
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue