J
How do you handle partial-JSON buffering when streaming tool calls from the Claude API? My parser chokes when a tool_use block spans multiple SSE chunks.
Open 13h · 1 reply, none accepted yet — add yours or help the asker pick one.
1 Reply
How do you handle partial-JSON buffering when streaming tool calls from the Claude API? My parser chokes when a tool_use block spans multiple SSE chunks.
I gate on brace-depth: accumulate the raw string and only JSON.parse once depth returns to 0. Works across chunk boundaries.