Skip to content

fix: initialize tools list when None before extending with MCP/platform tools#4645

Open
giulio-leone wants to merge 5 commits intocrewAIInc:mainfrom
giulio-leone:fix/mcp-tools-none-initialization
Open

fix: initialize tools list when None before extending with MCP/platform tools#4645
giulio-leone wants to merge 5 commits intocrewAIInc:mainfrom
giulio-leone:fix/mcp-tools-none-initialization

Conversation

@giulio-leone
Copy link

@giulio-leone giulio-leone commented Feb 28, 2026

Problem

When an Agent is created with mcps but without explicit tools, self.tools is None. The condition at line 1163:

if mcps and self.tools is not None:
    self.tools.extend(mcps)

silently skips MCP tool loading because self.tools is not None evaluates to False. The agent runs with no tools.

The same issue exists for platform_tools at line 1159.

Fix

Initialize self.tools to [] before calling .extend() when it is None.

Fixes #4568


Note

Low Risk
Low risk bug fix that only changes how Agent._prepare_kickoff appends platform/MCP tools when self.tools is unset; minimal behavioral impact beyond correctly enabling tool loading.

Overview
Fixes standalone Agent kickoff tool initialization so platform app tools and MCP tools are still added when self.tools starts as None.

_prepare_kickoff now initializes self.tools to an empty list before calling .extend() for platform/MCP tool lists, preventing those integrations from being silently skipped.

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

@giulio-leone giulio-leone force-pushed the fix/mcp-tools-none-initialization branch from 143ee17 to f8174e6 Compare February 28, 2026 14:39
@giulio-leone
Copy link
Author

Friendly ping — CI is green and this is ready for review. Happy to address any feedback. Thanks!

@giulio-leone giulio-leone force-pushed the fix/mcp-tools-none-initialization branch from f8174e6 to 0d1fe00 Compare March 1, 2026 02:14
Copilot AI review requested due to automatic review settings March 1, 2026 02:14
@cursor
Copy link

cursor bot commented Mar 1, 2026

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on March 28.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a kickoff-time tool initialization bug in Agent._prepare_kickoff where platform/MCP tools were not loaded if self.tools started as None, leaving the agent with no tools.

Changes:

  • Initialize self.tools to an empty list when needed before extending with platform tools.
  • Initialize self.tools to an empty list when needed before extending with MCP tools.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

giulio-leone and others added 4 commits March 1, 2026 19:54
…rm tools

When an Agent is created with mcps but without explicit tools, self.tools
is None. The condition 'mcps and self.tools is not None' silently skips
MCP tool loading, so the agent runs with no tools at all.

Initialize self.tools to [] before extending when it is None. Applied
to both platform_tools and MCP tools branches.

Fixes crewAIInc#4568
Initialize self.tools once before processing apps and mcps,
instead of checking in each block. Added regression test for
the specific bug scenario (tools=None with apps + mcps).
Initialize self.tools once before processing both platform and MCP
tools, removing duplicate None checks. Add regression test verifying
tools=None condition with MCP tools.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@giulio-leone giulio-leone force-pushed the fix/mcp-tools-none-initialization branch from 459bc18 to ee8f6bc Compare March 1, 2026 18:55
Rewrote test_tools_none_with_apps_and_mcps to call the actual
_prepare_kickoff method instead of reimplementing the guard logic
inline. This ensures the test catches any future divergence in the
real code path.

Refs: crewAIInc#4568
@giulio-leone
Copy link
Author

No worries — this is just an automated summary, no action needed.

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 mcps but tools is None, it will not load mcp tools

2 participants