Skip to content

Conversation

@pontemonti
Copy link
Contributor

Real-time threat detection feature requires us sending conversation id and user question. These are optional headers, but without them the real-time threat detection feature will not work. Added context headers 'x-ms-conversation-id' and 'x-ms-usermessage' to MCP requests.

…MCP requests. Needed for real-time threat detection feature.
Copilot AI review requested due to automatic review settings October 28, 2025 15:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds real-time threat detection support to the semantic kernel implementation by passing conversation context headers (x-ms-conversation-id and x-ms-usermessage) to MCP requests. These headers enable the real-time threat detection feature to function properly.

Key Changes:

  • Added a new HttpContextHeadersHandler that injects conversation context headers into HTTP requests
  • Updated the MCP client creation chain to include the new handler
  • Fixed project naming inconsistencies in the .csproj file

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/Tooling/Extensions/SemanticKernel/Services/McpToolRegistrationService.cs Updated method signatures to pass ITurnContext through the call chain and integrated the new HttpContextHeadersHandler into the HTTP handler pipeline
src/Tooling/Extensions/SemanticKernel/Handlers/HttpContextHeadersHandler.cs New handler that extracts conversation ID and user message from turn context and adds them as HTTP headers for threat detection
src/Tooling/Extensions/SemanticKernel/Microsoft.Agents.A365.Tooling.Extensions.SemanticKernel.csproj Corrected assembly, root namespace, and package ID to include "Extensions" in the naming

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pontemonti pontemonti merged commit e2d20b6 into main Oct 28, 2025
6 checks passed
@pontemonti pontemonti deleted the users/johanb/RealTimeThreatDetectionHeaders branch October 28, 2025 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants