[PR #12413] [MERGED] feat: Handle the case where a tool call sends "arguments" or "parameters" as a serialized json string #39689

Closed
opened 2026-04-23 00:40:39 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/12413
Author: @gabe-l-hart
Created: 9/25/2025
Status: Merged
Merged: 9/25/2025
Merged by: @jmorganca

Base: mainHead: StringToolCallArgs


📝 Commits (2)

  • ab04798 feat: Handle the case where a tool call sends "arguments" or "parameters" as a serialized json string
  • 370edba test: Add unit test cases for stringified arguments and parameters

📊 Changes

2 files changed (+28 additions, -0 deletions)

View changed files

📝 tools/tools.go (+12 -0)
📝 tools/tools_test.go (+16 -0)

📄 Description

Description

Some models will return their tool calls with the arguments represented as a serialized json object (a string) rather than a nested object. This PR adds support for this case by attempting to parse a string under "arguments" or "parameters" as an object and using that as the arguments for the tool call.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/12413 **Author:** [@gabe-l-hart](https://github.com/gabe-l-hart) **Created:** 9/25/2025 **Status:** ✅ Merged **Merged:** 9/25/2025 **Merged by:** [@jmorganca](https://github.com/jmorganca) **Base:** `main` ← **Head:** `StringToolCallArgs` --- ### 📝 Commits (2) - [`ab04798`](https://github.com/ollama/ollama/commit/ab04798b353184c6bfd5b4070c25e70a2211d26e) feat: Handle the case where a tool call sends "arguments" or "parameters" as a serialized json string - [`370edba`](https://github.com/ollama/ollama/commit/370edba4d86d90b7ce8c12f0ff20575dbae06d68) test: Add unit test cases for stringified arguments and parameters ### 📊 Changes **2 files changed** (+28 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `tools/tools.go` (+12 -0) 📝 `tools/tools_test.go` (+16 -0) </details> ### 📄 Description ## Description Some models will return their tool calls with the arguments represented as a serialized json object (a string) rather than a nested object. This PR adds support for this case by attempting to parse a string under `"arguments"` or `"parameters"` as an object and using that as the arguments for the tool call. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-23 00:40:39 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#39689