mirror of
https://github.com/anthropics/claude-code-sdk-python.git
synced 2025-12-23 09:19:52 +00:00
Fix bug where the is_error attribute from MCP tool output was being
disregarded instead of being passed to the resulting ToolResultBlock.
The issue was in the create_sdk_mcp_server function's call_tool handler,
which was only processing the content field from tool results and ignoring
the is_error field. Now when a tool returns {"is_error": True}, the handler
raises an exception so the MCP decorator can properly set isError=True in
the CallToolResult.
Changes:
- Modified call_tool handler in create_sdk_mcp_server to check for is_error field
- When is_error=True, raise RuntimeError with tool's error message
- Added comprehensive test for is_error field handling
Fixes issue where ToolResultBlock.is_error was None instead of True when
MCP tools returned error results.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| conftest.py | ||
| test_changelog.py | ||
| test_client.py | ||
| test_errors.py | ||
| test_integration.py | ||
| test_message_parser.py | ||
| test_sdk_mcp_integration.py | ||
| test_streaming_client.py | ||
| test_subprocess_buffering.py | ||
| test_tool_callbacks.py | ||
| test_transport.py | ||
| test_types.py | ||