-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
model context protocolIssue related to Model Context ProtocolIssue related to Model Context Protocolpython
Description
PR #2597 introduced a breaking change that prevents agent-framework from importing. The code references types.ToolUseContent and types.ToolResultContent which don't exist in any released version of the mcp package.
Error
AttributeError: module 'mcp.types' has no attribute 'ToolUseContent'Traceback:
File "/agent_framework/__init__.py", line 12, in <module>
from ._agents import *
File "/agent_framework/_agents.py", line 18, in <module>
from ._clients import BaseChatClient, ChatClientProtocol
File "/agent_framework/_clients.py", line 11, in <module>
from ._mcp import MCPTool
File "/agent_framework/_mcp.py", line 134, in <module>
| types.ToolUseContent
^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'mcp.types' has no attribute 'ToolUseContent'Root Cause
The issue was introduced in PR #2597 at _mcp.py:L134-L135:
def _mcp_type_to_ai_content(
mcp_type: types.ImageContent
| types.TextContent
| types.AudioContent
| types.EmbeddedResource
| types.ResourceLink
| types.ToolUseContent # ❌ DOES NOT EXIST in mcp package
| types.ToolResultContent # ❌ DOES NOT EXIST in mcp package
| Sequence[...],
) -> list[Contents]:Verification
I've tested with multiple mcp package versions (1.13.0, 1.19.0, 1.23.3). None contain these attributes.
Available Tool-related types in mcp.types:
ToolToolAnnotationsCallToolRequestCallToolRequestParamsCallToolResultListToolsRequestListToolsResultToolListChangedNotificationToolsCapability
Not available:
- ❌
ToolUseContent - ❌
ToolResultContent
Reproduction
from agent_framework import ChatMessage, Role, SequentialBuilder
# Fails immediately with AttributeErrorEnvironment
- agent-framework:
1.0.0b251204 - mcp:
1.13.0/1.19.0/1.23.3(all fail) - Python: 3.13
- OS: macOS
Impact
⚠️ Breaks all imports ofagent-framework⚠️ Affects DeepLearning.AI Microsoft Agent Framework course materials⚠️ Students and developers cannot use the package at all
Possible Solutions
- Remove the references to
ToolUseContentandToolResultContentif they're not needed - Pin
mcpto a specific version that contains these types (if one exists) - Add these types to the
mcppackage first, then reference them - Make these types optional with proper type guards
Related
- PR: Python: Pin meta core #2597
- Introduced: Last week (commit visible in blame view)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
model context protocolIssue related to Model Context ProtocolIssue related to Model Context Protocolpython
Type
Projects
Status
Done