Add initial task extension conformance coverage (#1734)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7c99928c-a943-49f4-9a63-8b04a0e4d18b
This commit is contained in:
parent
f7c61fafdb
commit
83523b0a42
2 changed files with 463 additions and 43 deletions
|
|
@ -1011,6 +1011,12 @@ internal sealed partial class McpServerImpl : McpServer
|
|||
$"A custom request handler registered through {nameof(McpServerOptions)}.{nameof(McpServerOptions.RequestHandlers)} has a null or empty {nameof(McpServerRequestHandler.Method)}.");
|
||||
}
|
||||
|
||||
if (entry.RoutingNameParameter is not null && string.IsNullOrWhiteSpace(entry.RoutingNameParameter))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
$"A custom request handler registered through {nameof(McpServerOptions)}.{nameof(McpServerOptions.RequestHandlers)} has an empty {nameof(McpServerRequestHandler.RoutingNameParameter)}.");
|
||||
}
|
||||
|
||||
// Custom handlers are registered after all built-in handlers, so a method already present
|
||||
// belongs to a built-in method (e.g. initialize, tools/call) or an earlier custom handler.
|
||||
// Silently overwriting it would bypass the built-in handler's filters and protocol gating,
|
||||
|
|
|
|||
|
|
@ -24,6 +24,17 @@ public sealed class McpServerRequestHandler
|
|||
/// </summary>
|
||||
public required string Method { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the top-level request parameter whose value is mirrored in the
|
||||
/// <c>Mcp-Name</c> HTTP routing header.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// When set, Streamable HTTP servers require the request to include an <c>Mcp-Name</c>
|
||||
/// header whose decoded value matches the string value of this parameter.
|
||||
/// </remarks>
|
||||
[Experimental(Experimentals.Subclassing_DiagnosticId, UrlFormat = Experimentals.Subclassing_Url)]
|
||||
public string? RoutingNameParameter { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the handler function that processes incoming requests for the specified method.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Reference in a new issue