Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/ModelContextProtocol.Core/RequestOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public JsonObject? Meta
}
set
{
// Preserve the progress token if set.
// Capture the existing progressToken value if set.
var progressToken = _meta?["progressToken"];
if (value is null)
{
Expand All @@ -52,7 +52,9 @@ public JsonObject? Meta
}
else
{
if (progressToken is not null) {
if (value["progressToken"] is null && progressToken is not null) {
// Remove existing progressToken so it can be set into the new meta.
_meta?.Remove("progressToken");
Comment thread
stephentoub marked this conversation as resolved.
Outdated
value["progressToken"] = progressToken;
Comment thread
stephentoub marked this conversation as resolved.
Outdated
}
_meta = value;
Expand Down Expand Up @@ -85,7 +87,6 @@ public ProgressToken? ProgressToken {
_meta ??= new JsonObject();
_meta["progressToken"] = token switch
{
null => _meta.Remove("progressToken"),
string s => s,
long l => l,
_ => throw new InvalidOperationException("ProgressToken must be a string or long"),
Expand Down
Loading