Fix Team.get_agentlet() signature for MCP server compatibility#1219
Merged
Conversation
The Team class was missing the active_mcp_servers parameter that was added to support MCP servers in the Agent class. This caused a TypeError when teams were used in environments with MCP servers enabled. Fixes #1218 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
ed3dc3f to
807e8c0
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a method signature incompatibility in the Team class that was causing TypeErrors when using teams in environments with MCP servers enabled. The issue arose when MCP server support was added to the Agent class but the Team class wasn't updated accordingly.
- Added
active_mcp_serversparameter toTeam.get_agentlet()method signature - Updated the method to pass the parameter through to the active member's
get_agentlet()call - Added comprehensive test coverage for the new functionality
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/marvin/agents/team.py | Added active_mcp_servers parameter to method signature and pass-through logic |
| tests/basic/actors/test_team.py | Added test case to verify proper handling of MCP servers parameter |
| examples/hello_team.py | Added example demonstrating Teams functionality |
| docs/api-reference/marvin-agents-team.mdx | Updated API documentation to reflect new method signature |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| from unittest.mock import AsyncMock, MagicMock | ||
|
|
||
| from pydantic_ai.mcp import MCPServer | ||
|
|
There was a problem hiding this comment.
[nitpick] Import statements should be placed at the top of the file rather than inside functions for better code organization and consistency.
Suggested change
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Team.get_agentlet()method signature to accept theactive_mcp_serversparameterThe Issue
The Teams/Swarm feature was broken due to a signature mismatch. When MCP server support was added to the Agent class, the
Team.get_agentlet()method wasn't updated to accept the newactive_mcp_serversparameter, causing a TypeError.The Fix
Updated
Team.get_agentlet()to:active_mcp_serversparameter in its signatureget_agentlet()callTest Plan
uv run pytest tests/basic/actors/test_team.py)Fixes #1218
🤖 Generated with Claude Code