Relax legacy request metadata validation (#1852)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: Tarek Mahmoud Sayed <10833894+tarekgh@users.noreply.github.com>
This commit is contained in:
parent
6001d5ac7a
commit
324ccd83c3
1 changed files with 780 additions and 391 deletions
|
|
@ -123,23 +123,23 @@ public class TaskProtocolGatingTests : ClientServerTestBase
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public async Task LegacyClient_CallToolRaw_WithForgedTaskOptIn_RejectsReservedMetadata()
|
||||
public async Task LegacyClient_CallToolRaw_WithForgedTaskOptIn_IgnoresPerRequestCapability()
|
||||
{
|
||||
await using var client = await CreateMcpClientForServer(new McpClientOptions { ProtocolVersion = LatestStableVersion });
|
||||
var ct = TestContext.Current.CancellationToken;
|
||||
|
||||
// Forge a SEP-2575 capabilities envelope carrying the tasks extension opt-in on a legacy
|
||||
// request. The server rejects reserved per-request metadata before it can affect behavior.
|
||||
var ex = await Assert.ThrowsAsync<McpProtocolException>(async () => await client.CallToolAsTaskAsync(
|
||||
// A forward-compatible client may carry SEP-2575 capabilities on a legacy request. The
|
||||
// metadata is tolerated, but it cannot opt the legacy session into modern-only tasks.
|
||||
var result = await client.CallToolAsTaskAsync(
|
||||
new CallToolRequestParams
|
||||
{
|
||||
Name = "test-tool",
|
||||
Arguments = CreateArguments("input", "forged"),
|
||||
Meta = CreateForgedTaskOptInMeta(),
|
||||
}, ct));
|
||||
}, ct);
|
||||
|
||||
Assert.Equal(McpErrorCode.InvalidRequest, ex.ErrorCode);
|
||||
Assert.Contains(ClientCapabilitiesMetaKey, ex.Message);
|
||||
Assert.False(result.IsTask);
|
||||
Assert.NotNull(result.Result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
Loading…
Reference in a new issue