fn finalize_tool_call(
body: &str,
out: &mut ParserOutput,
mint_id: impl FnMut() -> String,
)Expand description
Parse the accumulated tool-call body and push the resulting ToolCall
(or a NormalizationError) onto out.
Two body shapes are accepted, in order:
- JSON —
{"name":"foo","arguments":{...}}(Qwen2/2.5 native). - Inner XML —
<function=NAME><parameter=KEY>VAL</parameter>...</function>(Qwen3 +--jinja, Hermes-style).
JSON is tried first because it is the historical Qwen format and is
unambiguous; the XML form is the documented fallback for Qwen3 chat
templates that emit nested function/parameter markup inside <tool_call>.