[PR #4214] [MERGED] Update check for validFuncCall to only check required args and for undefined options #4556

Closed
opened 2026-02-22 18:36:04 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/4214
Author: @timothycarambat
Created: 7/30/2025
Status: Merged
Merged: 7/30/2025
Merged by: @timothycarambat

Base: masterHead: 3901-validFuncCall-optional-args


📝 Commits (4)

  • 6e765cb Update check for validFuncCall to only check required args and for undefined options
  • ba4fc6c update
  • 4d60929 remove unused helper class func
  • cc35b53 Merge branch 'master' into 3901-validFuncCall-optional-args

📊 Changes

2 files changed (+113 additions, -38 deletions)

View changed files

server/__tests__/utils/agents/aibitat/providers/helpers/untooled.test.js (+87 -0)
📝 server/utils/agents/aibitat/providers/helpers/untooled.js (+26 -38)

📄 Description

Pull Request Type

  • feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 🔨 chore
  • 📝 docs

Relevant Issues

resolves #3901

What is in this change?

  • Untooled updates for validFuncCall to explicitly check for missing required arguments
  • Validate only for args passed that are not explictly defined in the schema (hallunications)

Previously, we used to check for every argument value even if the argument was not required by the tool call schema. This lead to failures with MCP where the model would reasonably not include irrelevant parameters.

Since we did not backfill them with defaults from the schema they would instead fail as an invalid tool call.

Additional Information

Developer Validations

  • I ran yarn lint from the root of the repo & committed changes
  • Relevant documentation has been updated
  • I have tested my code functionality
  • Docker build succeeds locally

🔄 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/Mintplex-Labs/anything-llm/pull/4214 **Author:** [@timothycarambat](https://github.com/timothycarambat) **Created:** 7/30/2025 **Status:** ✅ Merged **Merged:** 7/30/2025 **Merged by:** [@timothycarambat](https://github.com/timothycarambat) **Base:** `master` ← **Head:** `3901-validFuncCall-optional-args` --- ### 📝 Commits (4) - [`6e765cb`](https://github.com/Mintplex-Labs/anything-llm/commit/6e765cb429af4f0e22b177781681237de8410651) Update check for `validFuncCall` to only check required args and for undefined options - [`ba4fc6c`](https://github.com/Mintplex-Labs/anything-llm/commit/ba4fc6ce1bd66242dfb8afa9239244c898471c1f) update - [`4d60929`](https://github.com/Mintplex-Labs/anything-llm/commit/4d60929ddc05a0047a40d0cfb0b66dda50147370) remove unused helper class func - [`cc35b53`](https://github.com/Mintplex-Labs/anything-llm/commit/cc35b53761451f4e86f6b4afb5510dd6d562fda6) Merge branch 'master' into 3901-validFuncCall-optional-args ### 📊 Changes **2 files changed** (+113 additions, -38 deletions) <details> <summary>View changed files</summary> ➕ `server/__tests__/utils/agents/aibitat/providers/helpers/untooled.test.js` (+87 -0) 📝 `server/utils/agents/aibitat/providers/helpers/untooled.js` (+26 -38) </details> ### 📄 Description ### Pull Request Type <!-- For change type, change [ ] to [x]. --> - [ ] ✨ feat - [x] 🐛 fix - [ ] ♻️ refactor - [ ] 💄 style - [ ] 🔨 chore - [ ] 📝 docs ### Relevant Issues <!-- Use "resolves #xxx" to auto resolve on merge. Otherwise, please use "connect #xxx" --> resolves #3901 ### What is in this change? - `Untooled` updates for `validFuncCall` to explicitly check for missing **required** arguments - Validate only for args passed that are not explictly defined in the schema (hallunications) Previously, we used to check for every argument value even if the argument was not required by the tool call schema. This lead to failures with MCP where the model would reasonably not include irrelevant parameters. Since we did not backfill them with defaults from the schema they would instead fail as an invalid tool call. <!-- Describe the changes in this PR that are impactful to the repo. --> ### Additional Information <!-- Add any other context about the Pull Request here that was not captured above. --> ### Developer Validations <!-- All of the applicable items should be checked. --> - [x] I ran `yarn lint` from the root of the repo & committed changes - [x] Relevant documentation has been updated - [x] I have tested my code functionality - [x] Docker build succeeds locally --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-22 18:36:04 -05:00
yindo closed this issue 2026-02-22 18:36:04 -05:00
yindo changed title from [PR #4214] Update check for `validFuncCall` to only check required args and for undefined options to [PR #4214] [MERGED] Update check for `validFuncCall` to only check required args and for undefined options 2026-06-05 15:19:10 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#4556