You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `McpToolRegistrationService` provides methods to send chat history from Semantic Kernel agents to the MCP platform for real-time threat protection and compliance monitoring.
64
+
65
+
### send_chat_history
66
+
67
+
Send chat history from a Semantic Kernel `ChatHistory` object:
68
+
69
+
```python
70
+
from semantic_kernel.contents import ChatHistory
71
+
from microsoft_agents_a365.tooling.extensions.semantickernel import McpToolRegistrationService
72
+
73
+
service = McpToolRegistrationService()
74
+
75
+
# Create and populate chat history
76
+
chat_history = ChatHistory()
77
+
chat_history.add_user_message("Hello!")
78
+
chat_history.add_assistant_message("Hi there! How can I help you?")
79
+
chat_history.add_user_message("Tell me about the weather.")
80
+
81
+
# Send chat history to MCP platform
82
+
result =await service.send_chat_history(
83
+
turn_context=turn_context,
84
+
chat_history=chat_history,
85
+
limit=50, # Optional: send only the most recent 50 messages
86
+
)
87
+
88
+
if result.succeeded:
89
+
print("Chat history sent successfully")
90
+
else:
91
+
print(f"Failed to send chat history: {result.errors}")
92
+
```
93
+
94
+
### send_chat_history_messages
95
+
96
+
Send a list of `ChatMessageContent` objects directly:
97
+
98
+
```python
99
+
from semantic_kernel.contents import ChatMessageContent, AuthorRole
100
+
from microsoft_agents_a365.tooling.extensions.semantickernel import McpToolRegistrationService
0 commit comments