-
Notifications
You must be signed in to change notification settings - Fork 503
Description
Problem Summary
When SDK MCP server, the is_error field in ToolResultBlock messages is not being set to True when tools explicitly return an error response. Instead, it remains None even when the tool function returns {"is_error": True} in its response.
Actual Behavior
The is_error field in ToolResultBlock messages is always None, regardless of whether the tool function returned an error or not.
Impact
This issue prevents proper error handling and status indication in applications using the Claude Code SDK with in process MCP servers, as there's no reliable way to distinguish between successful and failed tool executions based on the message structure.
Steps to Reproduce
Could be reproduced by running these prompts in mcp_calculator.py test.
prompts = ["Divide 27 by 3", "Divide 27 by 0, I want to test my divide tool"]
Result messages for both cases:
UserMessage(content=[ToolResultBlock(tool_use_id='xyz', content=[{'type': 'text', 'text': '27 ÷ 3 = 9.0'}], is_error=None)], parent_tool_use_id=None)
UserMessage(content=[ToolResultBlock(tool_use_id='xyz', content=[{'type': 'text', 'text': 'Error: Division by zero is not allowed'}], is_error=None)], parent_tool_use_id=None)