fine-grained-tool-streaming changedagents-and-tools/tool-use/fine-grained-tool-streaming
Nearest release: v2.1.307, published an hour after this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Recorded here
Lines+6added
Lines−6removed
From line
486
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits11to this page, all time
The whole hunk
from line 486, old and new numbered
/
from line 486
486486
487487The accumulation contract:
488488
4891. On `content_block_start` with `type: "tool_use"`, initialize an empty string: `input_json = ""`
4902. For each `content_block_delta` with `type: "input_json_delta"`, append: `input_json += event.delta.partial_json`
4913. On `content_block_stop`, parse the accumulated string
4891. On `content_block_start` with `type: "tool_use"`, initialize an empty string: `input_json = ""`.
4902. For each `content_block_delta` with `type: "input_json_delta"`, append: `input_json += event.delta.partial_json`.
4913. On `content_block_stop`, parse the accumulated string.
492492
493Guard the parse, as the following SDK examples do. A response can also stop at `max_tokens` midway through a parameter. Check the [stop reason](https://platform.claude.com/docs/en/build-with-claude/handling-stop-reasons) and decide whether to retry the request with a higher `max_tokens` or repair the partial input.
493Guard the parse, as the following example does. A response can also stop at `max_tokens` midway through a parameter. Check the [stop reason](https://platform.claude.com/docs/en/build-with-claude/handling-stop-reasons) and decide whether to retry the request with a higher `max_tokens` or repair the partial input.
494494
495495The type mismatch between the initial `input: {}` (object) and `partial_json` (string) is by design. The empty object marks the slot in the content array. The delta strings build the real value.
496496
from line 931
931931 </Card>
932932
933933 <Card title="Handle tool calls" icon="arrows-left-right" href="https://platform.claude.com/docs/en/agents-and-tools/tool-use/handle-tool-calls">
934 Parse tool\_use blocks, format tool\_result responses, and handle errors with is\_error.
934 Parse `tool_use` blocks, format `tool_result` responses, and handle errors with `is_error`.
935935 </Card>
936936
937937 <Card title="Tool reference" icon="book" href="https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-reference">
No line in this hunk matches that.