Skip to content

fix: prepare MCP tools in execute_task for delegated agents#4625

Open
Anandesh-Sharma wants to merge 1 commit intocrewAIInc:mainfrom
Anandesh-Sharma:fix/4571-mcp-delegation-prepare
Open

fix: prepare MCP tools in execute_task for delegated agents#4625
Anandesh-Sharma wants to merge 1 commit intocrewAIInc:mainfrom
Anandesh-Sharma:fix/4571-mcp-delegation-prepare

Conversation

@Anandesh-Sharma
Copy link

Summary

  • Fixes MCP tools not being available when a sub-agent receives a delegated task
  • MCP tools are only resolved during the kickoff preparation path, but execute_task() (used for delegation) never triggers MCP resolution
  • Adds MCP tool resolution at the start of execute_task() when the resolver hasn't been initialized yet, ensuring delegated agents have access to their MCP tools

Fixes #4571

Test plan

  • Create a main agent with delegation and a sub-agent with MCP servers
  • Verify the sub-agent can use MCP tools when receiving delegated tasks
  • Verify agents that go through normal kickoff still work correctly (idempotent check)
  • Verify agents without MCP servers are unaffected

🤖 Generated with Claude Code

MCP tools are only resolved during the kickoff preparation path, but
when an agent receives a delegated task via execute_task(), MCP tools
are never prepared. This means sub-agents with MCP servers configured
cannot use their MCP tools when receiving delegated work.

Check if the MCP resolver hasn't been initialized yet and resolve MCP
tools at the start of execute_task() to ensure they're available for
delegated agents.

Fixes crewAIInc#4571

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]When i use mcp at sub agent, it will not load

1 participant