[PR #15317] tools: support parsing tool calls with omitted arguments #40986

Open
opened 2026-04-23 01:45:01 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15317
Author: @Akshatkasera
Created: 4/4/2026
Status: 🔄 Open

Base: mainHead: fix/tool-omitted-arguments


📝 Commits (1)

  • 825d87d tools: support parsing tool calls with omitted arguments

📊 Changes

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

View changed files

📝 tools/tools.go (+10 -12)
📝 tools/tools_test.go (+18 -1)

📄 Description

Summary

  • Fixed findArguments to correctly handle tool calls where the arguments object is omitted entirely
  • Previously, {"name": "get_conditions"} was silently ignored because the parser couldn't distinguish "no tool call found" from "tool call found with no arguments"
  • Added a third bool return value to findArguments to differentiate between these two cases
  • Added 2 new test cases covering omitted and empty arguments

Resolves the TODO at tools/tools.go:223 (added by @jmorganca)

Context

When a model calls a tool that has all-optional parameters, it may omit the arguments object entirely:

{"name": "get_conditions"}


---

<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/15317 **Author:** [@Akshatkasera](https://github.com/Akshatkasera) **Created:** 4/4/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/tool-omitted-arguments` --- ### 📝 Commits (1) - [`825d87d`](https://github.com/ollama/ollama/commit/825d87d5c7aee52411d7efa012cecd11342f0348) tools: support parsing tool calls with omitted arguments ### 📊 Changes **2 files changed** (+28 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `tools/tools.go` (+10 -12) 📝 `tools/tools_test.go` (+18 -1) </details> ### 📄 Description ## Summary - Fixed `findArguments` to correctly handle tool calls where the `arguments` object is omitted entirely - Previously, `{"name": "get_conditions"}` was silently ignored because the parser couldn't distinguish "no tool call found" from "tool call found with no arguments" - Added a third `bool` return value to `findArguments` to differentiate between these two cases - Added 2 new test cases covering omitted and empty arguments Resolves the TODO at `tools/tools.go:223` (added by @jmorganca) ## Context When a model calls a tool that has all-optional parameters, it may omit the `arguments` object entirely: ```json {"name": "get_conditions"} --- <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 01:45:01 -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#40986