claude-code-sdk-python/tests
Claude e15e3f82ae
fix: preserve is_error attribute from MCP tool output in ToolResultBlock
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>
2025-10-14 17:20:36 +00:00
..
conftest.py Initial Python SDK import 2025-06-12 00:16:19 -07:00
test_changelog.py Add changelog and changelog format check (#77) 2025-07-21 10:53:01 -07:00
test_client.py Rename claude_code to claude_agent (#188) 2025-09-28 14:52:53 -07:00
test_errors.py Rename claude_code to claude_agent (#188) 2025-09-28 14:52:53 -07:00
test_integration.py refactor: remove unnecessary node installation check (#189) 2025-09-28 15:16:40 -07:00
test_message_parser.py Rename claude_code to claude_agent (#188) 2025-09-28 14:52:53 -07:00
test_sdk_mcp_integration.py fix: preserve is_error attribute from MCP tool output in ToolResultBlock 2025-10-14 17:20:36 +00:00
test_streaming_client.py Fix Windows test failures due to path separator issues (#219) 2025-10-07 16:18:30 -07:00
test_subprocess_buffering.py feat: add cli_path support to ClaudeAgentOptions (#235) 2025-10-12 23:19:53 -07:00
test_tool_callbacks.py feat: add strongly-typed hook inputs with TypedDict (#240) 2025-10-10 16:22:13 -07:00
test_transport.py feat: add cli_path support to ClaudeAgentOptions (#235) 2025-10-12 23:19:53 -07:00
test_types.py Update model references to claude-sonnet-4-5 (#198) 2025-09-30 12:59:14 -07:00