Commit Graph

4 Commits

Author SHA1 Message Date
Devin AI
50d2e4c1b0 fix: inject MCP tools during delegation (fixes #4571)
When an agent with MCP servers configured is used as a sub-agent via
delegation, its MCP tools were not loaded because the Crew's
_prepare_tools() is not called for the delegated-to agent.

This fix adds _inject_mcp_tools() to agent/utils.py and calls it from
prepare_tools(), which is invoked by both execute_task() and
aexecute_task(). MCP tools are now loaded on-demand when the agent has
mcps configured, with deduplication and graceful error handling.

Also adds 11 tests covering:
- MCP tool injection with/without mcps
- Deduplication of existing tools
- Graceful failure handling
- prepare_tools integration
- Full delegation flow

Co-Authored-By: João <joao@crewai.com>
2026-02-23 15:49:58 +00:00
Greyson LaLonde
bed9a3847a fix: remove invalid param from sse client (#3980) 2025-11-26 21:37:55 -08:00
Lorenze Jay
b2c278ed22 refactor: improve MCP tool execution handling with concurrent futures (#3854)
- Enhanced the MCP tool execution in both synchronous and asynchronous contexts by utilizing  for better event loop management.
- Updated error handling to provide clearer messages for connection issues and task cancellations.
- Added tests to validate MCP tool execution in both sync and async scenarios, ensuring robust functionality across different contexts.
2025-11-06 19:28:08 -08:00
Lorenze Jay
6f36d7003b Lorenze/feat mcp first class support (#3850)
* WIP transport support mcp

* refactor: streamline MCP tool loading and error handling

* linted

* Self type from typing with typing_extensions in MCP transport modules

* added tests for mcp setup

* added tests for mcp setup

* docs: enhance MCP overview with detailed integration examples and structured configurations

* feat: implement MCP event handling and logging in event listener and client

- Added MCP event types and handlers for connection and tool execution events.
- Enhanced MCPClient to emit events on connection status and tool execution.
- Updated ConsoleFormatter to handle MCP event logging.
- Introduced new MCP event types for better integration and monitoring.
2025-11-06 17:45:16 -08:00