Hide experimental types from external source generators using internal property pattern (#1301)
This commit is contained in:
parent
231e013160
commit
cc6ef5b926
7 changed files with 315 additions and 7 deletions
|
|
@ -1,3 +1,4 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
|
|
@ -33,6 +34,16 @@ public sealed class CallToolRequestParams : RequestParams
|
|||
/// When present, indicates that the requestor wants this operation executed as a task.
|
||||
/// The receiver must support task augmentation for this specific request type.
|
||||
/// </remarks>
|
||||
[Experimental(Experimentals.Tasks_DiagnosticId, UrlFormat = Experimentals.Tasks_Url)]
|
||||
[JsonIgnore]
|
||||
public McpTaskMetadata? Task
|
||||
{
|
||||
get => TaskCore;
|
||||
set => TaskCore = value;
|
||||
}
|
||||
|
||||
// See ExperimentalInternalPropertyTests.cs before modifying this property.
|
||||
[JsonInclude]
|
||||
[JsonPropertyName("task")]
|
||||
public McpTaskMetadata? Task { get; set; }
|
||||
internal McpTaskMetadata? TaskCore { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json.Nodes;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
|
|
@ -72,6 +73,16 @@ public sealed class CallToolResult : Result
|
|||
/// (<see cref="Content"/>, <see cref="StructuredContent"/>, <see cref="IsError"/>) may not be populated.
|
||||
/// The actual tool result can be retrieved later via <c>tasks/result</c>.
|
||||
/// </remarks>
|
||||
[Experimental(Experimentals.Tasks_DiagnosticId, UrlFormat = Experimentals.Tasks_Url)]
|
||||
[JsonIgnore]
|
||||
public McpTask? Task
|
||||
{
|
||||
get => TaskCore;
|
||||
set => TaskCore = value;
|
||||
}
|
||||
|
||||
// See ExperimentalInternalPropertyTests.cs before modifying this property.
|
||||
[JsonInclude]
|
||||
[JsonPropertyName("task")]
|
||||
public McpTask? Task { get; set; }
|
||||
internal McpTask? TaskCore { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.ComponentModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json.Serialization;
|
||||
using ModelContextProtocol.Client;
|
||||
using ModelContextProtocol.Server;
|
||||
|
|
@ -80,6 +81,16 @@ public sealed class ClientCapabilities
|
|||
/// See <see cref="McpTasksCapability"/> for details on configuring which operations support tasks.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[Experimental(Experimentals.Tasks_DiagnosticId, UrlFormat = Experimentals.Tasks_Url)]
|
||||
[JsonIgnore]
|
||||
public McpTasksCapability? Tasks
|
||||
{
|
||||
get => TasksCore;
|
||||
set => TasksCore = value;
|
||||
}
|
||||
|
||||
// See ExperimentalInternalPropertyTests.cs before modifying this property.
|
||||
[JsonInclude]
|
||||
[JsonPropertyName("tasks")]
|
||||
public McpTasksCapability? Tasks { get; set; }
|
||||
internal McpTasksCapability? TasksCore { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
|
|
@ -160,6 +161,16 @@ public sealed class CreateMessageRequestParams : RequestParams
|
|||
/// When present, indicates that the requestor wants this operation executed as a task.
|
||||
/// The receiver must support task augmentation for this specific request type.
|
||||
/// </remarks>
|
||||
[Experimental(Experimentals.Tasks_DiagnosticId, UrlFormat = Experimentals.Tasks_Url)]
|
||||
[JsonIgnore]
|
||||
public McpTaskMetadata? Task
|
||||
{
|
||||
get => TaskCore;
|
||||
set => TaskCore = value;
|
||||
}
|
||||
|
||||
// See ExperimentalInternalPropertyTests.cs before modifying this property.
|
||||
[JsonInclude]
|
||||
[JsonPropertyName("task")]
|
||||
public McpTaskMetadata? Task { get; set; }
|
||||
internal McpTaskMetadata? TaskCore { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,8 +99,18 @@ public sealed class ElicitRequestParams : RequestParams
|
|||
/// When present, indicates that the requestor wants this operation executed as a task.
|
||||
/// The receiver must support task augmentation for this specific request type.
|
||||
/// </remarks>
|
||||
[Experimental(Experimentals.Tasks_DiagnosticId, UrlFormat = Experimentals.Tasks_Url)]
|
||||
[JsonIgnore]
|
||||
public McpTaskMetadata? Task
|
||||
{
|
||||
get => TaskCore;
|
||||
set => TaskCore = value;
|
||||
}
|
||||
|
||||
// See ExperimentalInternalPropertyTests.cs before modifying this property.
|
||||
[JsonInclude]
|
||||
[JsonPropertyName("task")]
|
||||
public McpTaskMetadata? Task { get; set; }
|
||||
internal McpTaskMetadata? TaskCore { get; set; }
|
||||
|
||||
/// <summary>Represents a request schema used in a form mode elicitation request.</summary>
|
||||
public sealed class RequestSchema
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.ComponentModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json.Serialization;
|
||||
using ModelContextProtocol.Server;
|
||||
|
||||
|
|
@ -79,6 +80,16 @@ public sealed class ServerCapabilities
|
|||
/// See <see cref="McpTasksCapability"/> for details on configuring which operations support tasks.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[Experimental(Experimentals.Tasks_DiagnosticId, UrlFormat = Experimentals.Tasks_Url)]
|
||||
[JsonIgnore]
|
||||
public McpTasksCapability? Tasks
|
||||
{
|
||||
get => TasksCore;
|
||||
set => TasksCore = value;
|
||||
}
|
||||
|
||||
// See ExperimentalInternalPropertyTests.cs before modifying this property.
|
||||
[JsonInclude]
|
||||
[JsonPropertyName("tasks")]
|
||||
public McpTasksCapability? Tasks { get; set; }
|
||||
internal McpTasksCapability? TasksCore { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,8 +128,17 @@ public sealed class Tool : IBaseMetadata
|
|||
/// regarding task augmentation support. See <see cref="ToolExecution"/> for details.
|
||||
/// </remarks>
|
||||
[Experimental(Experimentals.Tasks_DiagnosticId, UrlFormat = Experimentals.Tasks_Url)]
|
||||
[JsonIgnore]
|
||||
public ToolExecution? Execution
|
||||
{
|
||||
get => ExecutionCore;
|
||||
set => ExecutionCore = value;
|
||||
}
|
||||
|
||||
// See ExperimentalInternalPropertyTests.cs before modifying this property.
|
||||
[JsonInclude]
|
||||
[JsonPropertyName("execution")]
|
||||
public ToolExecution? Execution { get; set; }
|
||||
internal ToolExecution? ExecutionCore { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets an optional list of icons for this tool.
|
||||
|
|
|
|||
Loading…
Reference in a new issue