* Initial computer use sample implementation.
* Added background thread to allow polling for long running requests.
* Removed unrequired try-catch block and added missing thread for agent call.
* Removed irrelevant chatOptions and updated code based on feedback.
* Updated image assets and fixed response issue.
* Updated based on PR comments.
* Update to Azure.AI.Project
---------
Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
* Fix: Prevent duplicate MCP tools and prompts (#1876)
- Added deduplication logic in MCPTool.load_tools() method
- Added deduplication logic in MCPTool.load_prompts() method
- Track existing function names before loading from MCP server
- Skip tools/prompts that are already registered in _functions list
- Prevents 400 error from Azure AI Foundry caused by duplicate tool names
The issue occurred because load_tools() was being called multiple times
(during connect() and by notification handlers), causing tools to be
appended without duplicate checking.
Changes made:
1. In load_tools(): Added existing_names set to track registered functions
2. In load_tools(): Added check to skip tools already in existing_names
3. In load_prompts(): Applied same deduplication pattern
Testing:
- Created unit test verifying deduplication logic
- Confirmed duplicates are skipped correctly
- Confirmed new functions are added correctly
- Prevents duplicate tool names being sent to LLM
Fixes#1876
* Address review feedback: Prevent multiple calls to load_tools and load_prompts
- Added _tools_loaded and _prompts_loaded flags to MCPTool class
- Modified load_tools() to check if already loaded and return early
- Modified load_prompts() to check if already loaded and return early
- Moved test cases from test_mcp_fix.py to test_mcp.py
- Added tests for multiple call prevention
- Deleted separate test_mcp_fix.py file
Addresses review feedback from @eavanvalkenburg:
- Prevents accidental multiple calls to load_tools()
- Prevents accidental multiple calls to load_prompts()
- Test file now in proper location (test_mcp.py)
* Address review feedback: Move flag checks to connect() and remove comments
- Removed verbose comments from code
- Moved _tools_loaded and _prompts_loaded checks to connect() method
- Allows manual calls to load_tools() and load_prompts() for updates
- Updated tests to reflect new behavior
- connect() now prevents duplicate loading during connection
- Users can still manually call load_tools()/load_prompts() to refresh
Addresses feedback from @eavanvalkenburg
* Fix: Code quality and formatting issues
- Applied black formatting
- Fixed ruff linting issues
- All tests passing locally
* chore: Re-run uv lock per review request
* Apply pre-commit formatting: consolidate type annotations
- Consolidate multi-line type annotations to single line
- Remove unnecessary parentheses
- Apply ruff format and security checks
* Move Purview integration logic into middleware
* Improve error handling and user id management
* Rename purview package
* Handle 402s more explicitly; add Middleware generation methods; don't ignore exceptions
* Use DI container; pass scope id to PC
* Add protection scope caching
* Wrap more exceptions in PurviewClient
* Remove block check dedup; add tests
* Refactor PurviewWrapper intialization; Add unit tests
* Use different .Use method and add IDisposable stub
* Add background job processing for Purview
* Misc comment cleanup
* Apply copilot comments
* Fix formatting
* Formatting other files to fix pipeline
* Small updates to settings and exceptions
* Add README
* Move Purview sample
* Address review comments and update XML comments
* Newline after namespace
* Move public Purview classes to single namespace; Clean up csproj and slnx
* Commit the renames
* Remove unused openAI dependency
---------
Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com>
* fix devui regression from #2021 where all input is stringified but devui HIL input does not handle stringified json strings correctly.
* update incorrect test
* add devui hil input tests
This commit fixes three issues in the security_filter_middleware:
1. Missing context.terminate flag - Without this, middleware continues processing after setting blocked response
2. No streaming support - When context.is_streaming is True, middleware now returns async generator with ChatResponseUpdate
3. Checks all messages - Changed to check only context.messages[-1] (most recent user message) instead of iterating through conversation history
Changes:
- Added AsyncIterable import
- Added ChatResponseUpdate and TextContent imports
- Modified security_filter_middleware to handle both streaming and non-streaming modes
- Added context.terminate = True to properly stop execution
- Changed message checking logic to only inspect the last user message
Co-authored-by: Victor Dibia <chuvidi2003@gmail.com>
Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>