Follow-ups to #1610: de-draft 2026-07-28 terminology, renumber error codes, ProtocolVersion floor (#1671)

This commit is contained in:
Stephen Halter 2026-06-25 14:07:52 -07:00 • committed by GitHub
commit d6b1615988
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -59,7 +59,7 @@ public sealed class McpServerResourceRoutingTests(ITestOutputHelper testOutputHe
/// <summary>
/// Asserts that the given URI does NOT match the template. Uses the default client, which
/// negotiates the draft protocol revision, so the unknown-resource response carries the
/// negotiates the 2026-07-28 protocol revision, so the unknown-resource response carries the
/// standard JSON-RPC <see cref="McpErrorCode.InvalidParams"/> (-32602). The version-gated
/// legacy mapping to <see cref="McpErrorCode.ResourceNotFound"/> (-32002) is covered by
/// <see cref="ResourceNotFound_ErrorCode_IsVersionGated"/>.
@ -79,7 +79,7 @@ public sealed class McpServerResourceRoutingTests(ITestOutputHelper testOutputHe
}
// Unknown-resource-URI responses are version-gated: older clients keep the legacy
// -32002 (McpErrorCode.ResourceNotFound), and clients on the draft protocol version that
// -32002 (McpErrorCode.ResourceNotFound), and clients on the 2026-07-28 protocol version that
// moves to the standard JSON-RPC code see -32602 (McpErrorCode.InvalidParams).
[Theory]
[InlineData("2025-11-25", McpErrorCode.ResourceNotFound)]
@ -134,7 +134,7 @@ public sealed class McpServerResourceRoutingTests(ITestOutputHelper testOutputHe
// Literal template braces in URI should not match (template literal is not a valid URI)
var mcpEx = await Assert.ThrowsAsync<McpProtocolException>(async () => await client.ReadResourceAsync("test://params{?a1,a2,a3}", null, TestContext.Current.CancellationToken));
// Draft maps an unmatched resource URI to InvalidParams (-32602); the legacy -32002 ResourceNotFound
// The 2026-07-28 protocol maps an unmatched resource URI to InvalidParams (-32602); the legacy -32002 ResourceNotFound
// mapping is covered by the version-gated ResourceNotFound_ErrorCode_IsVersionGated theory.
Assert.Equal(McpErrorCode.InvalidParams, mcpEx.ErrorCode);
Assert.Equal("Request failed (remote): Unknown resource URI: 'test://params{?a1,a2,a3}'", mcpEx.Message);