Remove ExperimentalAttribute from official Extensions/Tasks/MRTR APIs and align MCPEXP001 usage (#1642)
This commit is contained in:
parent
e7b450efc1
commit
90c853103d
16 changed files with 9 additions and 62 deletions
|
|
@ -27,7 +27,7 @@ If you use experimental APIs, you will get one of the diagnostics shown below. T
|
|||
|
||||
| Diagnostic ID | Description |
|
||||
| :------------ | :---------- |
|
||||
| `MCPEXP001` | Experimental APIs for features in the MCP specification itself, including Tasks and Extensions. Tasks provide a mechanism for asynchronous long-running operations that can be polled for status and results (see [SEP-2663](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/seps/2663-tasks-extension.md)). Extensions provide a framework for extending the Model Context Protocol while maintaining interoperability (see [SEP-2133](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2133)). |
|
||||
| `MCPEXP001` | Experimental APIs tied to MCP specification features. Reuse this ID for newly introduced experimental spec features, and add feature-specific messages/URLs in `Experimentals`. |
|
||||
| `MCPEXP002` | Experimental SDK APIs unrelated to the MCP specification itself, including subclassing `McpClient`/`McpServer` (see [#1363](https://github.com/modelcontextprotocol/csharp-sdk/pull/1363)) and `RunSessionHandler`, which may be removed or change signatures in a future release (consider using `ConfigureSessionOptions` instead). |
|
||||
| `MCPEXP003` | Experimental MCP Apps extension APIs. MCP Apps is the first official MCP extension (`io.modelcontextprotocol/ui`), enabling servers to deliver interactive UIs inside AI clients (see [MCP Apps specification](https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/2026-01-26/apps.mdx)). |
|
||||
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ namespace ModelContextProtocol;
|
|||
/// Experimental diagnostic IDs are grouped by category:
|
||||
/// <list type="bullet">
|
||||
/// <item><description>
|
||||
/// <c>MCPEXP001</c> covers APIs related to experimental features in the MCP specification itself,
|
||||
/// such as Extensions. These APIs may change as the specification evolves.
|
||||
/// <c>MCPEXP001</c> covers APIs related to experimental features in the MCP specification itself.
|
||||
/// These APIs may change as the specification evolves.
|
||||
/// </description></item>
|
||||
/// <item><description>
|
||||
/// <c>MCPEXP002</c> covers experimental SDK APIs that are unrelated to the MCP specification,
|
||||
|
|
@ -36,19 +36,13 @@ namespace ModelContextProtocol;
|
|||
internal static class Experimentals
|
||||
{
|
||||
/// <summary>
|
||||
/// Diagnostic ID for the experimental MCP Extensions feature.
|
||||
/// Diagnostic ID for experimental MCP specification features.
|
||||
/// </summary>
|
||||
public const string Extensions_DiagnosticId = "MCPEXP001";
|
||||
|
||||
/// <summary>
|
||||
/// Message for the experimental MCP Extensions feature.
|
||||
/// </summary>
|
||||
public const string Extensions_Message = "The Extensions feature is part of a future MCP specification version that has not yet been ratified and is subject to change.";
|
||||
|
||||
/// <summary>
|
||||
/// URL for the experimental MCP Extensions feature.
|
||||
/// </summary>
|
||||
public const string Extensions_Url = "https://github.com/modelcontextprotocol/csharp-sdk/blob/main/docs/list-of-diagnostics.md#mcpexp001";
|
||||
/// <remarks>
|
||||
/// When introducing a new experimental specification feature, add feature-specific message
|
||||
/// and URL constants that use this diagnostic ID.
|
||||
/// </remarks>
|
||||
public const string SpecificationFeature_DiagnosticId = "MCPEXP001";
|
||||
|
||||
/// <summary>
|
||||
/// Diagnostic ID for experimental MCP Apps extension APIs.
|
||||
|
|
@ -110,22 +104,4 @@ internal static class Experimentals
|
|||
/// </summary>
|
||||
public const string RunSessionHandler_Url = "https://github.com/modelcontextprotocol/csharp-sdk/blob/main/docs/list-of-diagnostics.md#mcpexp002";
|
||||
|
||||
/// <summary>
|
||||
/// Diagnostic ID for the experimental Multi Round-Trip Requests (MRTR) feature.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This uses the same diagnostic ID as <see cref="Extensions_DiagnosticId"/> because MRTR
|
||||
/// is an experimental feature in the MCP specification (SEP-2322).
|
||||
/// </remarks>
|
||||
public const string Mrtr_DiagnosticId = "MCPEXP001";
|
||||
|
||||
/// <summary>
|
||||
/// Message for the experimental MRTR feature.
|
||||
/// </summary>
|
||||
public const string Mrtr_Message = "The Multi Round-Trip Requests (MRTR) feature is experimental per the MCP specification (SEP-2322) and is subject to change.";
|
||||
|
||||
/// <summary>
|
||||
/// URL for the experimental MRTR feature.
|
||||
/// </summary>
|
||||
public const string Mrtr_Url = "https://github.com/modelcontextprotocol/csharp-sdk/blob/main/docs/list-of-diagnostics.md#mcpexp001";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System.ComponentModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json.Serialization;
|
||||
using ModelContextProtocol.Client;
|
||||
using ModelContextProtocol.Server;
|
||||
|
|
@ -84,7 +83,6 @@ public sealed class ClientCapabilities
|
|||
/// interoperability. Clients advertise extension support via this field during the initialization handshake.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[Experimental(Experimentals.Extensions_DiagnosticId, UrlFormat = Experimentals.Extensions_Url)]
|
||||
[JsonIgnore]
|
||||
public IDictionary<string, object>? Extensions
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
|
|
@ -20,7 +19,6 @@ namespace ModelContextProtocol.Protocol;
|
|||
/// parameters can be accessed via the typed accessor properties.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[Experimental(Experimentals.Mrtr_DiagnosticId, UrlFormat = Experimentals.Mrtr_Url)]
|
||||
[JsonConverter(typeof(Converter))]
|
||||
public sealed class InputRequest
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace ModelContextProtocol.Protocol;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -54,7 +52,6 @@ namespace ModelContextProtocol.Protocol;
|
|||
/// }
|
||||
/// </code>
|
||||
/// </example>
|
||||
[Experimental(Experimentals.Mrtr_DiagnosticId, UrlFormat = Experimentals.Mrtr_Url)]
|
||||
public class InputRequiredException : Exception
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace ModelContextProtocol.Protocol;
|
||||
|
|
@ -22,7 +21,6 @@ namespace ModelContextProtocol.Protocol;
|
|||
/// This type is part of the Multi Round-Trip Requests (MRTR) mechanism defined in SEP-2322.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[Experimental(Experimentals.Mrtr_DiagnosticId, UrlFormat = Experimentals.Mrtr_Url)]
|
||||
public sealed class InputRequiredResult : Result
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Text.Json.Serialization.Metadata;
|
||||
|
|
@ -21,7 +20,6 @@ namespace ModelContextProtocol.Protocol;
|
|||
/// the corresponding <see cref="InputRequest.Method"/> key in the <see cref="InputRequiredResult.InputRequests"/> map.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[Experimental(Experimentals.Mrtr_DiagnosticId, UrlFormat = Experimentals.Mrtr_Url)]
|
||||
[JsonConverter(typeof(Converter))]
|
||||
public sealed class InputResponse
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json.Nodes;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
|
|
@ -36,7 +35,6 @@ public abstract class RequestParams
|
|||
/// the value is the client's response to that input request.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[Experimental(Experimentals.Mrtr_DiagnosticId, UrlFormat = Experimentals.Mrtr_Url)]
|
||||
[JsonIgnore]
|
||||
public IDictionary<string, InputResponse>? InputResponses
|
||||
{
|
||||
|
|
@ -59,7 +57,6 @@ public abstract class RequestParams
|
|||
/// exact value without modification.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[Experimental(Experimentals.Mrtr_DiagnosticId, UrlFormat = Experimentals.Mrtr_Url)]
|
||||
[JsonIgnore]
|
||||
public string? RequestState
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System.ComponentModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json.Serialization;
|
||||
using ModelContextProtocol.Server;
|
||||
|
||||
|
|
@ -82,7 +81,6 @@ public sealed class ServerCapabilities
|
|||
/// interoperability. Servers advertise extension support via this field during the initialization handshake.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[Experimental(Experimentals.Extensions_DiagnosticId, UrlFormat = Experimentals.Extensions_Url)]
|
||||
[JsonIgnore]
|
||||
public IDictionary<string, object>? Extensions
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using ModelContextProtocol.Protocol;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace ModelContextProtocol.Server;
|
||||
|
|
@ -31,7 +30,6 @@ namespace ModelContextProtocol.Server;
|
|||
/// specification for details on the tasks extension.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[Experimental(Experimentals.Extensions_DiagnosticId, UrlFormat = Experimentals.Extensions_Url)]
|
||||
public interface IMcpTaskStore
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using ModelContextProtocol.Protocol;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Immutable;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace ModelContextProtocol.Server;
|
||||
|
|
@ -20,7 +19,6 @@ namespace ModelContextProtocol.Server;
|
|||
/// implement a custom <see cref="IMcpTaskStore"/>.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[Experimental(Experimentals.Extensions_DiagnosticId, UrlFormat = Experimentals.Extensions_Url)]
|
||||
public class InMemoryMcpTaskStore : IMcpTaskStore
|
||||
{
|
||||
private readonly ConcurrentDictionary<string, McpTaskInfo> _tasks = new();
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
using ModelContextProtocol.Protocol;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace ModelContextProtocol.Server;
|
||||
|
||||
/// <summary>
|
||||
/// Provides data for the <see cref="IMcpTaskStore.InputResponseReceived"/> event.
|
||||
/// </summary>
|
||||
[Experimental(Experimentals.Extensions_DiagnosticId, UrlFormat = Experimentals.Extensions_Url)]
|
||||
public sealed class InputResponseReceivedEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -600,7 +600,6 @@ public abstract partial class McpServer : McpSession
|
|||
/// <param name="taskId">The task ID in the store.</param>
|
||||
/// <param name="store">The task store to write input requests to.</param>
|
||||
/// <returns>An <see cref="IDisposable"/> that restores the previous context when disposed.</returns>
|
||||
[Experimental(Experimentals.Extensions_DiagnosticId, UrlFormat = Experimentals.Extensions_Url)]
|
||||
public IDisposable CreateMcpTaskScope(
|
||||
string taskId,
|
||||
IMcpTaskStore store)
|
||||
|
|
|
|||
|
|
@ -81,7 +81,6 @@ public abstract partial class McpServer : McpSession
|
|||
/// the required feature) instead of throwing <see cref="Protocol.InputRequiredException"/>.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[Experimental(Experimentals.Mrtr_DiagnosticId, UrlFormat = Experimentals.Mrtr_Url)]
|
||||
public virtual bool IsMrtrSupported => false;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace ModelContextProtocol.Server;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -9,7 +7,6 @@ namespace ModelContextProtocol.Server;
|
|||
/// and <see cref="McpServer.RequestRootsAsync(ModelContextProtocol.Protocol.ListRootsRequestParams, CancellationToken)"/>
|
||||
/// are redirected through the task store as input requests rather than sent directly to the client.
|
||||
/// </summary>
|
||||
[Experimental(Experimentals.Extensions_DiagnosticId, UrlFormat = Experimentals.Extensions_Url)]
|
||||
internal sealed class McpTaskExecutionContext
|
||||
{
|
||||
internal static readonly AsyncLocal<McpTaskExecutionContext?> Current = new();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using ModelContextProtocol.Protocol;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace ModelContextProtocol.Server;
|
||||
|
|
@ -14,7 +13,6 @@ namespace ModelContextProtocol.Server;
|
|||
/// types (<see cref="CreateTaskResult"/>, <see cref="GetTaskResult"/>) when communicating with clients.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[Experimental(Experimentals.Extensions_DiagnosticId, UrlFormat = Experimentals.Extensions_Url)]
|
||||
public sealed record McpTaskInfo(
|
||||
string TaskId,
|
||||
McpTaskStatus Status,
|
||||
|
|
|
|||
Loading…
Reference in a new issue