-
Notifications
You must be signed in to change notification settings - Fork 697
Split McpTasksCapability into ServerMcpTasksCapability and ClientMcpTasksCapability #1529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jayaraman-venkatesan
wants to merge
2
commits into
modelcontextprotocol:main
Choose a base branch
from
jayaraman-venkatesan:refactor/split-mcp-tasks-capability-server-client
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
src/ModelContextProtocol.Core/CompatibilitySuppressions.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/ModelContextProtocol.Core/Protocol/CancelMcpTasksCapability.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| using System.Diagnostics.CodeAnalysis; | ||
|
|
||
| namespace ModelContextProtocol.Protocol; | ||
|
|
||
| /// <summary> | ||
| /// Represents the capability for cancelling tasks. | ||
| /// </summary> | ||
| [Experimental(Experimentals.Tasks_DiagnosticId, UrlFormat = Experimentals.Tasks_Url)] | ||
| public sealed class CancelMcpTasksCapability; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/ModelContextProtocol.Core/Protocol/ClientMcpTasksCapability.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| using System.Diagnostics.CodeAnalysis; | ||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace ModelContextProtocol.Protocol; | ||
|
|
||
| /// <summary> | ||
| /// Represents the tasks capability configuration for clients. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// <para> | ||
| /// The tasks capability enables servers to augment their requests with tasks for long-running | ||
| /// operations. Tasks are durable state machines that carry information about the underlying | ||
| /// execution state of requests. | ||
| /// </para> | ||
| /// <para> | ||
| /// During initialization, both parties exchange their tasks capabilities to establish which | ||
| /// operations support task-based execution. Requestors should only augment requests with a | ||
| /// task if the corresponding capability has been declared by the receiver. | ||
| /// </para> | ||
| /// </remarks> | ||
| [Experimental(Experimentals.Tasks_DiagnosticId, UrlFormat = Experimentals.Tasks_Url)] | ||
| public sealed class ClientMcpTasksCapability | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets whether this client supports the tasks/list operation. | ||
| /// </summary> | ||
| [JsonPropertyName("list")] | ||
| public ListMcpTasksCapability? List { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets whether this client supports the tasks/cancel operation. | ||
| /// </summary> | ||
| [JsonPropertyName("cancel")] | ||
| public CancelMcpTasksCapability? Cancel { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets which client request types support task augmentation. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// For clients, this includes <c>tasks.requests.sampling.createMessage</c> and | ||
| /// <c>tasks.requests.elicitation.create</c>. | ||
| /// </remarks> | ||
| [JsonPropertyName("requests")] | ||
| public ClientRequestMcpTasksCapability? Requests { get; set; } | ||
| } | ||
65 changes: 65 additions & 0 deletions
65
src/ModelContextProtocol.Core/Protocol/ClientRequestMcpTasksCapability.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| using System.Diagnostics.CodeAnalysis; | ||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace ModelContextProtocol.Protocol; | ||
|
|
||
| /// <summary> | ||
| /// Represents task support for client request types. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// Clients can only support task augmentation for <c>sampling/createMessage</c> and | ||
| /// <c>elicitation/create</c> requests. | ||
| /// </remarks> | ||
| [Experimental(Experimentals.Tasks_DiagnosticId, UrlFormat = Experimentals.Tasks_Url)] | ||
| public sealed class ClientRequestMcpTasksCapability | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets task support for sampling-related requests. | ||
| /// </summary> | ||
| [JsonPropertyName("sampling")] | ||
| public SamplingMcpTasksCapability? Sampling { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets task support for elicitation-related requests. | ||
| /// </summary> | ||
| [JsonPropertyName("elicitation")] | ||
| public ElicitationMcpTasksCapability? Elicitation { get; set; } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Represents task support for sampling-related requests. | ||
| /// </summary> | ||
| [Experimental(Experimentals.Tasks_DiagnosticId, UrlFormat = Experimentals.Tasks_Url)] | ||
| public sealed class SamplingMcpTasksCapability | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets whether sampling/createMessage requests support task augmentation. | ||
| /// </summary> | ||
| [JsonPropertyName("createMessage")] | ||
| public CreateMessageMcpTasksCapability? CreateMessage { get; set; } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Represents the capability for task-augmented sampling/createMessage requests. | ||
| /// </summary> | ||
| [Experimental(Experimentals.Tasks_DiagnosticId, UrlFormat = Experimentals.Tasks_Url)] | ||
| public sealed class CreateMessageMcpTasksCapability; | ||
|
|
||
| /// <summary> | ||
| /// Represents task support for elicitation-related requests. | ||
| /// </summary> | ||
| [Experimental(Experimentals.Tasks_DiagnosticId, UrlFormat = Experimentals.Tasks_Url)] | ||
| public sealed class ElicitationMcpTasksCapability | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets whether elicitation/create requests support task augmentation. | ||
| /// </summary> | ||
| [JsonPropertyName("create")] | ||
| public CreateElicitationMcpTasksCapability? Create { get; set; } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Represents the capability for task-augmented elicitation/create requests. | ||
| /// </summary> | ||
| [Experimental(Experimentals.Tasks_DiagnosticId, UrlFormat = Experimentals.Tasks_Url)] | ||
| public sealed class CreateElicitationMcpTasksCapability; |
9 changes: 9 additions & 0 deletions
9
src/ModelContextProtocol.Core/Protocol/ListMcpTasksCapability.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| using System.Diagnostics.CodeAnalysis; | ||
|
|
||
| namespace ModelContextProtocol.Protocol; | ||
|
|
||
| /// <summary> | ||
| /// Represents the capability for listing tasks. | ||
| /// </summary> | ||
| [Experimental(Experimentals.Tasks_DiagnosticId, UrlFormat = Experimentals.Tasks_Url)] | ||
| public sealed class ListMcpTasksCapability; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tasks are not necessary for long-running operations.