Skip to content

Comments

Fix #4568: Initialize tools list when None before extending with MCP/platform tools#4570

Open
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1771858545-fix-mcp-tools-none-tools
Open

Fix #4568: Initialize tools list when None before extending with MCP/platform tools#4570
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1771858545-fix-mcp-tools-none-tools

Conversation

@devin-ai-integration
Copy link
Contributor

Summary

Fixes #4568. When an agent is created with mcps but without tools (or tools=None), MCP tools were silently dropped in _prepare_kickoff because the condition self.tools is not None failed before extend() could be called. The same issue affected platform apps tools.

The fix initializes self.tools to [] when it is None before extending, for both the MCP and platform apps code paths.

Before:

if mcps and self.tools is not None:  # silently skips when tools is None
    self.tools.extend(mcps)

After:

if mcps:
    if self.tools is None:
        self.tools = []
    self.tools.extend(mcps)

Review & Testing Checklist for Human

  • Tests duplicate inline logic rather than calling _prepare_kickoff directly — the 4 new tests replicate the conditional pattern manually instead of exercising the actual method. Consider whether an integration-level test through _prepare_kickoff is needed for stronger regression coverage.
  • Verify with a real MCP server — create an agent with only mcps=[MCPServerHTTP(url="...")] (no tools kwarg) and confirm the MCP tools are actually discovered and usable during kickoff().
  • The apps (platform tools) path has the same fix applied but no corresponding test was added.

Notes

…rm tools

Fixes #4568

When an agent is created with mcps but without tools (or tools=None),
the MCP tools were silently dropped because _prepare_kickoff checked
'self.tools is not None' before extending. This fix initializes
self.tools to an empty list when it is None before extending with
MCP or platform tools.

Co-Authored-By: João <joao@crewai.com>
@devin-ai-integration
Copy link
Contributor Author

Prompt hidden (unlisted session)

@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

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

0 participants