Align x-mcp-header implementation with SEP-2243 spec clarifications (#1619)
Co-authored-by: Tarek Mahmoud Sayed <tarekms@ntdev.microsoft.com>
This commit is contained in:
parent
719eade5e0
commit
ed19286a08
1 changed files with 1035 additions and 116 deletions
|
|
@ -186,8 +186,10 @@ public abstract partial class McpClient : McpSession
|
|||
tools ??= new(toolResults.Tools.Count);
|
||||
foreach (var tool in toolResults.Tools)
|
||||
{
|
||||
// Validate x-mcp-header annotations per SEP-2243.
|
||||
// Clients MUST exclude tools with invalid annotations and SHOULD log a warning.
|
||||
// Validate x-mcp-header annotations per SEP-2243. The spec requires Streamable HTTP
|
||||
// clients to exclude tools with invalid annotations and permits other transports
|
||||
// (e.g., stdio) to ignore the annotations entirely. This client validates on all
|
||||
// transports so a malformed definition is rejected consistently regardless of transport.
|
||||
if (!McpHeaderExtractor.ValidateToolSchema(tool, out var rejectionReason))
|
||||
{
|
||||
ToolRejected?.Invoke(tool, rejectionReason!);
|
||||
|
|
|
|||
Loading…
Reference in a new issue