branch: externals/llm commit 9cbd2220107d50c47a759b91d142321b88ec32a9 Author: Paul Nelson <63298781+ultron...@users.noreply.github.com> Commit: GitHub <nore...@github.com>
Fix Claude tool use with empty arguments (#171) (#172) * (llm-provider-collect-streaming-tool-uses): Handle case where Claude returns the empty string for tool use arguments. --- llm-claude.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/llm-claude.el b/llm-claude.el index eda858a103..fb9a5a94dc 100644 --- a/llm-claude.el +++ b/llm-claude.el @@ -208,9 +208,11 @@ DATA is a vector of lists produced by `llm-provider-streaming-media-handler'." (concat (llm-provider-utils-tool-use-args tool) input))))) (maphash (lambda (_ tool) (condition-case nil - (setf (llm-provider-utils-tool-use-args tool) - (json-parse-string (llm-provider-utils-tool-use-args tool) - :object-type 'alist)) + (let ((args (llm-provider-utils-tool-use-args tool))) + (setf (llm-provider-utils-tool-use-args tool) + (if (string-empty-p args) + nil + (json-parse-string args :object-type 'alist)))) (error nil)) (push tool result)) tools)