mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-04-15 07:22:44 +00:00
Fixes #5116. MCPToolResolver._resolve_native() could raise UnboundLocalError when asyncio.run() raised a RuntimeError that didn't match the 'cancel scope' or 'task' conditions — the exception was silently swallowed leaving tools_list unbound. Changes: - Initialize tools_list to an empty list before the try block - Add early return with warning log when tools_list is empty (matching the existing behavior in _resolve_external) This covers three scenarios: 1. MCP server returns no tools 2. tool_filter removes all tools 3. RuntimeError swallowed without assigning tools_list Co-Authored-By: João <joao@crewai.com>