ollama/tools
Aditya Aggarwal 32a97b7493
tools: ignore braces inside JSON strings when detecting tool call end (#16937)
Parser.done() counted the tag's open/close characters ({}, []) without
tracking JSON string context, so a streamed tool call whose string
argument value contained a closing brace or bracket (e.g.
{"code": "if (x) { y }"}) was treated as complete too early and flushed to
the user as plain text instead of being parsed as a tool call.

findArguments() in the same file already tracks string context; apply the
same handling in done() so open/close characters inside string values are
ignored.
2026-06-27 12:00:55 -07:00
..
template.go tools: loosen tool parsing to allow for more formats (#11030) 2025-06-12 14:18:54 -07:00
template_test.go tools: loosen tool parsing to allow for more formats (#11030) 2025-06-12 14:18:54 -07:00
tools.go tools: ignore braces inside JSON strings when detecting tool call end (#16937) 2026-06-27 12:00:55 -07:00
tools_test.go tools: ignore braces inside JSON strings when detecting tool call end (#16937) 2026-06-27 12:00:55 -07:00