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
Copy file name to clipboardExpand all lines: CLAUDE.md
+35-1Lines changed: 35 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -168,11 +168,45 @@ Place it before imports with one blank line after.
168
168
169
169
### Python Conventions
170
170
171
-
- Type hints preferred (Pydantic models heavily used)
171
+
- Type hints required on all function parameters and return types
172
172
- Async/await patterns for I/O operations
173
173
- Use explicit `None` checks: `if x is not None:` not `if x:`
174
174
- Local imports should be moved to top of file
175
175
- Return defensive copies of mutable data to protect singletons
176
+
-**Async method naming**: Do NOT use `_async` suffix on async methods. The `_async` suffix is only appropriate when providing both sync and async versions of the same method. Since this SDK is async-only, use plain method names (e.g., `send_chat_history_messages` not `send_chat_history_messages_async`)
177
+
178
+
### Type Hints - NEVER Use `Any`
179
+
180
+
**CRITICAL: Never use `typing.Any` in this codebase.** Using `Any` defeats the purpose of type checking and can hide bugs. Instead:
181
+
182
+
1.**Use actual types from external SDKs** - When integrating with external libraries (OpenAI, LangChain, etc.), import and use their actual types:
3.**Use `object` for truly unknown types** that you only pass through:
198
+
```python
199
+
deflog_item(item: object) -> None: ...
200
+
```
201
+
202
+
4.**Use `Protocol` only as a last resort** - If external types cannot be found or imported, define a Protocol. However, **confirm with the developer first** before proceeding with this approach, as it may indicate a missing dependency or incorrect understanding of the external API.
203
+
204
+
**Why this matters:**
205
+
-`Any` disables all type checking for that variable
206
+
- Bugs that type checkers would catch go unnoticed
207
+
- Code readability suffers - developers don't know what types to expect
208
+
- Using actual SDK types provides better IDE support and ensures compatibility
209
+
- This applies to both production code AND test files
Copy file name to clipboardExpand all lines: docs/design.md
+43-1Lines changed: 43 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -227,9 +227,51 @@ Framework-specific adapters for MCP tool integration:
227
227
|---------|---------|------------|
228
228
|`extensions-agentframework`| Adapt MCP tools to Microsoft Agents SDK |[design.md](../libraries/microsoft-agents-a365-tooling-extensions-agentframework/docs/design.md)|
229
229
|`extensions-azureaifoundry`| Azure AI Foundry tool integration |[design.md](../libraries/microsoft-agents-a365-tooling-extensions-azureaifoundry/docs/design.md)|
230
-
|`extensions-openai`| OpenAI function calling integration |[design.md](../libraries/microsoft-agents-a365-tooling-extensions-openai/docs/design.md)|
230
+
|`extensions-openai`| OpenAI function calling integration and chat history |[design.md](../libraries/microsoft-agents-a365-tooling-extensions-openai/docs/design.md)|
The methods convert OpenAI message types to `ChatHistoryMessage` format and delegate to the core `McpToolServerConfigurationService.send_chat_history()` method.
The service provides methods to send chat history to the MCP platform for real-time threat protection analysis. This enables security scanning of conversation content.
82
+
83
+
#### send_chat_history_messages
84
+
85
+
The primary method for sending chat history. Converts Agent Framework `ChatMessage` objects to the `ChatHistoryMessage` format expected by the MCP platform.
86
+
87
+
```python
88
+
from agent_framework import ChatMessage, Role
89
+
90
+
service = McpToolRegistrationService()
91
+
92
+
# Create messages
93
+
messages = [
94
+
ChatMessage(role=Role.USER, text="Hello, how are you?"),
0 commit comments