` tags. The de-facto standard, reused by Qwen2.5/Qwen3-Instruct. Anchored on the literal tags — zero collision with bare JSON.">
Skip to content
1 min read · 82 words

Variable: hermesToolCallParser

ts
const hermesToolCallParser: ToolCallParserFn;

Defined in: src/batteries/llm/chat_common/tool_parsers.ts:158

Parse Hermes-style <tool_call>{"name":…,"arguments":{…}}</tool_call> tags. The de-facto standard, reused by Qwen2.5/Qwen3-Instruct. Anchored on the literal tags — zero collision with bare JSON.

Remarks

The JSON object after each <tool_call> is located by a string-aware balanced-brace scan (not a lazy </tool_call> regex), so an embedded </tool_call> or {/} inside a string argument value (e.g. {"text":"</tool_call>"}) survives instead of truncating the call. The literal </tool_call> close is still consumed for span removal when present immediately after the object.