[PR #14995] tools: warn when model tool call names don't match registered tools #46206

Open
opened 2026-04-25 01:43:11 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/14995
Author: @MoonMao42
Created: 3/21/2026
Status: 🔄 Open

Base: mainHead: tool-name-mismatch-warn


📝 Commits (2)

  • c02efa8 tools: warn when model tool call names don't match registered tools
  • c3dacee Require arguments/parameters field to flag unmatched tool calls

📊 Changes

3 files changed (+190 additions, -0 deletions)

View changed files

📝 server/routes.go (+6 -0)
📝 tools/tools.go (+81 -0)
📝 tools/tools_test.go (+103 -0)

📄 Description

Fixes #14967.

When tools are registered but the model responds with a function name that doesn't match any of them (e.g. get-orders-at-risk-count vs GetOrdersAtRiskCount), the response just comes back with finish_reason: "stop" and no indication of what went wrong. This makes it really hard to debug, especially when tool names are transformed between systems.

This adds a server-side slog.Warn that fires when the generic tool parser finishes without matching any registered tools but finds tool-call-like JSON in the model output. The warning includes both the name the model tried to call and the list of registered tool names, so you can immediately spot the mismatch.

Example log output:

WARN model attempted tool calls that did not match any registered tools attempted=["get-orders-at-risk-count"] registered=["GetOrdersAtRiskCount"]

Only affects the generic parser path — the harmony parser already has its own warning via OriginalFromConverted. No changes to API behavior or response format.


🔄 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/14995 **Author:** [@MoonMao42](https://github.com/MoonMao42) **Created:** 3/21/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `tool-name-mismatch-warn` --- ### 📝 Commits (2) - [`c02efa8`](https://github.com/ollama/ollama/commit/c02efa8914d0b6bc7b3d9b82ac59aed9a6063ef0) tools: warn when model tool call names don't match registered tools - [`c3dacee`](https://github.com/ollama/ollama/commit/c3daceeea4cc0c5010a69d30dd67b5b675fbcf05) Require arguments/parameters field to flag unmatched tool calls ### 📊 Changes **3 files changed** (+190 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `server/routes.go` (+6 -0) 📝 `tools/tools.go` (+81 -0) 📝 `tools/tools_test.go` (+103 -0) </details> ### 📄 Description Fixes #14967. When tools are registered but the model responds with a function name that doesn't match any of them (e.g. `get-orders-at-risk-count` vs `GetOrdersAtRiskCount`), the response just comes back with `finish_reason: "stop"` and no indication of what went wrong. This makes it really hard to debug, especially when tool names are transformed between systems. This adds a server-side `slog.Warn` that fires when the generic tool parser finishes without matching any registered tools but finds tool-call-like JSON in the model output. The warning includes both the name the model tried to call and the list of registered tool names, so you can immediately spot the mismatch. Example log output: ``` WARN model attempted tool calls that did not match any registered tools attempted=["get-orders-at-risk-count"] registered=["GetOrdersAtRiskCount"] ``` Only affects the generic parser path — the harmony parser already has its own warning via `OriginalFromConverted`. No changes to API behavior or response format. --- <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-25 01:43:11 -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#46206