Fix WithMeta + WithProgress causing tool invocation failure (#1464)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
This commit is contained in:
Copilot 2026-03-27 15:41:58 -04:00 • committed by GitHub
commit 49bf17077d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -877,7 +877,7 @@ public abstract partial class McpClient : McpSession
return default;
}).ConfigureAwait(false);
JsonObject metaWithProgress = meta is not null ? new(meta) : [];
JsonObject metaWithProgress = meta is not null ? (JsonObject)meta.DeepClone() : [];
metaWithProgress["progressToken"] = progressToken.ToString();
return await CallToolAsync(
@ -1007,7 +1007,7 @@ public abstract partial class McpClient : McpSession
return default;
}).ConfigureAwait(false);
JsonObject metaWithProgress = meta is not null ? new(meta) : [];
JsonObject metaWithProgress = meta is not null ? (JsonObject)meta.DeepClone() : [];
metaWithProgress["progressToken"] = progressToken.ToString();
var result = await SendRequestAsync(