Skip to content

Conversation

@JakeMY-coder
Copy link

@JakeMY-coder JakeMY-coder commented Jan 5, 2026

Summary

When kicking off a crew run in hierarchical mode, any MCP tools owned by agents are ignored even if they are required for successful task completion. The cause is simple: in hierarchical mode, the agent_to_use for prepare_tools is always the manager agent.

From prepare_task_execution in utils.py:

    tools_for_task = task.tools or agent_to_use.tools or []
    tools_for_task = crew._prepare_tools(
        agent_to_use,
        task,
        tools_for_task,
    )

Effectively, this function is checking the manager agent against tasks assigned to subordinate agents to see if any tools should be made available for the upcoming agent activation. As a result, subordinate agents never have the necessary tools for task execution in hierarchical mode.

Fix:

In the _prepare_tools function in crew.py, check to see if there is an agent assigned to the task:

        task_agent = task.agent or agent

Then, when preparing mcp and platform tools, use that task's agent instead of the manager agent to retrieve the relevant tools for the activation:

        if task_agent and (hasattr(task_agent, "apps") and getattr(task_agent, "apps", None)):
            tools = self._add_platform_tools(task, tools)

        if task_agent and (hasattr(task_agent, "mcps") and getattr(task_agent, "mcps", None)):
            tools = self._add_mcp_tools(task, tools)

Note

Fixes tool resolution in hierarchical mode by selecting the task’s agent when preparing tools.

  • In Crew._prepare_tools, introduce task_agent = task.agent or agent and use it to add platform and mcp tools via _add_platform_tools and _add_mcp_tools
  • Prevents loss of task-bound tools when the manager agent is passed during hierarchical execution

Written by Cursor Bugbot for commit 1c245af. This will update automatically on new commits. Configure here.

@JakeMY-coder
Copy link
Author

After further testing, I'm not sure this fix solves the problem. I'm at a loss. MCP tools, agents, and crew executions work fine in sequential mode. As soon as I begin executing in hierarchical mode with a designated manager agent the MCP tools no longer appear in agent prompts, leading to confusion and hallucination.

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.

1 participant