BetaInputJsonEvent not fired for server_tool_use blocks during streaming
lib/streaming/_beta_messages.py fires BetaInputJsonEvent for tool_use and mcp_tool_use content blocks but not for server_tool_use, even though the API streams input_json_delta events for server tools the same way.
Code in question (_beta_messages.py:367-376):
elif event.delta.type == "input_json_delta":
if content_block.type == "tool_use" or content_block.type == "mcp_tool_use":
events_to_fire.append(
build(
BetaInputJsonEvent,
type="input_json",
partial_json=event.delta.partial_json,
snapshot=content_block.input,
)
)
This is inconsistent with the accumulator's own TRACKS_TOOL_INPUT tuple (_beta_messages.py:441), which does include BetaServerToolUseBlock — so the SDK correctly accumulates the streamed input into content_block.input, but never fires the parsed event to consumers.
Impact: Consumers using the stream helpers can't observe the input to server-side tools (e.g. tool_search_tool_regex, web_search) as it streams in. The only workaround is to bypass BetaInputJsonEvent entirely and match on the raw BetaRawContentBlockDeltaEvent with a BetaInputJSONDelta delta.
Suggested fix: include "server_tool_use" in the content-block type check on line 368:
if content_block.type in ("tool_use", "mcp_tool_use", "server_tool_use"):
SDK version: 0.92.0
Fixed in v0.122.0 (https://github.com/anthropics/anthropic-sdk-python/commit/ccfc8e140e8e6b824e74c8fd9bed2587e60c5b6f). The stream helpers now emit input_json events for server_tool_use blocks. Thanks for the report.