File tree Expand file tree Collapse file tree
ModelContextProtocol.Core/Protocol
ModelContextProtocol.Extensions.Tasks Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6969 <Project Path =" src/ModelContextProtocol.AspNetCore/ModelContextProtocol.AspNetCore.csproj" />
7070 <Project Path =" src/ModelContextProtocol.Core/ModelContextProtocol.Core.csproj" />
7171 <Project Path =" src/ModelContextProtocol.Extensions.Apps/ModelContextProtocol.Extensions.Apps.csproj" />
72+ <Project Path =" src/ModelContextProtocol.Extensions.Tasks/ModelContextProtocol.Extensions.Tasks.csproj" />
7273 <Project Path =" src/ModelContextProtocol/ModelContextProtocol.csproj" />
7374 </Folder >
7475 <Folder Name =" /tests/" >
Original file line number Diff line number Diff line change @@ -8,8 +8,8 @@ namespace ModelContextProtocol.Protocol;
88/// </summary>
99public abstract class NotificationParams
1010{
11- /// <summary>Prevent external derivations.</summary>
12- private protected NotificationParams ( )
11+ /// <summary>Allow derivations only within the SDK and its extension packages .</summary>
12+ protected NotificationParams ( )
1313 {
1414 }
1515
Original file line number Diff line number Diff line change @@ -11,8 +11,8 @@ namespace ModelContextProtocol.Protocol;
1111/// </remarks>
1212public abstract class RequestParams
1313{
14- /// <summary>Prevent external derivations.</summary>
15- private protected RequestParams ( )
14+ /// <summary>Allow derivations only within the SDK and its extension packages .</summary>
15+ protected RequestParams ( )
1616 {
1717 }
1818
Original file line number Diff line number Diff line change @@ -8,8 +8,8 @@ namespace ModelContextProtocol.Protocol;
88/// </summary>
99public abstract class Result
1010{
11- /// <summary>Prevent external derivations.</summary>
12- private protected Result ( )
11+ /// <summary>Allow derivations only within the SDK and its extension packages .</summary>
12+ protected Result ( )
1313 {
1414 }
1515
Load diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 2626 <Compile Include =" ..\Common\Experimentals.cs" Link =" Experimentals.cs" />
2727 </ItemGroup >
2828
29- <!-- Exclude polyfills inherited from Directory.Build.props; this package only needs the ExperimentalAttribute polyfill . -->
29+ <!-- Exclude polyfills inherited from Directory.Build.props; include only the attribute polyfills these DTOs need . -->
3030 <ItemGroup >
3131 <Compile Remove =" ..\Common\Polyfills\**\*.cs" />
3232 <Compile Include =" ..\Common\Polyfills\System\Diagnostics\CodeAnalysis\ExperimentalAttribute.cs"
3333 Link =" Polyfills\ExperimentalAttribute.cs" />
34+ <Compile Include =" ..\Common\Polyfills\System\Diagnostics\CodeAnalysis\NullableAttributes.cs"
35+ Link =" Polyfills\NullableAttributes.cs" />
36+ <Compile Include =" ..\Common\Polyfills\System\Diagnostics\CodeAnalysis\SetsRequiredMembersAttribute.cs"
37+ Link =" Polyfills\SetsRequiredMembersAttribute.cs" />
38+ <Compile Include =" ..\Common\Polyfills\System\Runtime\CompilerServices\CompilerFeatureRequiredAttribute.cs"
39+ Link =" Polyfills\CompilerFeatureRequiredAttribute.cs" />
40+ <Compile Include =" ..\Common\Polyfills\System\Runtime\CompilerServices\RequiredMemberAttribute.cs"
41+ Link =" Polyfills\RequiredMemberAttribute.cs" />
42+ <Compile Include =" ..\Common\Polyfills\System\Runtime\CompilerServices\IsExternalInit.cs"
43+ Link =" Polyfills\IsExternalInit.cs" />
3444 </ItemGroup >
3545
3646 <ItemGroup >
Original file line number Diff line number Diff line change @@ -31,8 +31,7 @@ public class ResultOrCreatedTask<TResult> where TResult : Result
3131 /// <param name="result">The standard result returned by the server.</param>
3232 public ResultOrCreatedTask ( TResult result )
3333 {
34- Throw . IfNull ( result ) ;
35- _result = result ;
34+ _result = result ?? throw new ArgumentNullException ( nameof ( result ) ) ;
3635 }
3736
3837 /// <summary>
@@ -41,8 +40,7 @@ public ResultOrCreatedTask(TResult result)
4140 /// <param name="taskCreated">The task creation result returned by the server.</param>
4241 public ResultOrCreatedTask ( CreateTaskResult taskCreated )
4342 {
44- Throw . IfNull ( taskCreated ) ;
45- _taskCreated = taskCreated ;
43+ _taskCreated = taskCreated ?? throw new ArgumentNullException ( nameof ( taskCreated ) ) ;
4644 }
4745
4846 /// <summary>
Load diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ namespace ModelContextProtocol.Extensions.Tasks;
3636[ JsonSerializable ( typeof ( IDictionary < string , InputRequest > ) ) ]
3737[ JsonSerializable ( typeof ( IDictionary < string , InputResponse > ) ) ]
3838[ JsonSerializable ( typeof ( JsonObject ) ) ]
39+ [ JsonSerializable ( typeof ( JsonNode ) ) ]
3940[ JsonSerializable ( typeof ( JsonElement ) ) ]
4041[ JsonSerializable ( typeof ( JsonRpcErrorDetail ) ) ]
4142internal sealed partial class TasksJsonContext : JsonSerializerContext
Original file line number Diff line number Diff line change 1+ namespace ModelContextProtocol . Extensions . Tasks ;
2+
3+ /// <summary>
4+ /// Provides constants for the JSON-RPC methods defined by the MCP Tasks extension (SEP-2663).
5+ /// </summary>
6+ public static class TaskMethods
7+ {
8+ /// <summary>The <c>tasks/get</c> request method, used to retrieve the current state of a task.</summary>
9+ public const string Get = "tasks/get" ;
10+
11+ /// <summary>The <c>tasks/update</c> request method, used to provide input responses to a task.</summary>
12+ public const string Update = "tasks/update" ;
13+
14+ /// <summary>The <c>tasks/cancel</c> request method, used to request cancellation of a task.</summary>
15+ public const string Cancel = "tasks/cancel" ;
16+
17+ /// <summary>The <c>notifications/tasks/status</c> notification method, used to push task status updates.</summary>
18+ public const string StatusNotification = "notifications/tasks/status" ;
19+ }
20+
21+ /// <summary>
22+ /// Provides constants for the <c>_meta</c> keys defined by the MCP Tasks extension (SEP-2663).
23+ /// </summary>
24+ public static class TaskMetaKeys
25+ {
26+ /// <summary>The <c>_meta</c> key carrying the related task identifier.</summary>
27+ public const string RelatedTask = "io.modelcontextprotocol/related-task" ;
28+ }
You can’t perform that action at this time.
0 commit comments