Parse accumulated tool-chunk args into a finalized block.
Shared between the compat bridge's _finalize_block and the
ChatModelStream end-of-stream sweep. Parses raw_args as JSON:
on success builds the requested finalized type (tool_call or
server_tool_call) with provider-specific fields (extras)
preserved; on failure falls back to invalid_tool_call carrying
the raw string so downstream consumers can still introspect the
malformed payload.
Provider-specific fields to carry onto the finalized
block. Callers are responsible for having already dropped
keys they don't want propagated (notably type, id,
name, args, and index on client-side tool_call).
"tool_call" or "server_tool_call".