.NET: Fix InvokeMcpTool approval path for declarative workflows (#6177)

* Fix InvokeMcpTool approval path for declarative workflows

* Added more test for coverage.
This commit is contained in:
Peter Ibekwe
2026-05-29 12:07:48 -07:00
committed by GitHub
Unverified
parent 6510d6e3c8
commit 11c8d89ab2
2 changed files with 150 additions and 7 deletions
@@ -75,18 +75,14 @@ internal sealed class InvokeMcpToolExecutor(
if (requireApproval)
{
// Create tool call content for approval request
// Create tool call content for approval request.
// Transport headers (e.g. Authorization) are intentionally excluded from the
// approval event: they must not cross into the externally-surfaced approval request.
McpServerToolCallContent toolCall = new(this.Id, toolName, serverLabel ?? serverUrl)
{
Arguments = arguments
};
if (headers != null)
{
toolCall.AdditionalProperties ??= [];
toolCall.AdditionalProperties.Add(headers);
}
ToolApprovalRequestContent approvalRequest = new(this.Id, toolCall);
ChatMessage requestMessage = new(ChatRole.Assistant, [approvalRequest]);