fix: add nvidia to PROVIDER_TOOL_LIMITS (1536) to prevent tool truncation (#6177)

NVIDIA NIM API (nvidia/* models) silently truncates the tool list to 128
(the default MAX_TOOLS_LIMIT) because nvidia is not in PROVIDER_TOOL_LIMITS.
Tools beyond index 127 are dropped, causing agents to lose access to
critical tools like task, read, or high-index MCP tools.

Verified that NVIDIA NIM API supports up to 1536 tools by direct testing.
End-to-end confirmed: 198 tools sent, model successfully called tools at
indices 193, 195, and 197 (previously dropped by truncation to 128).

Follows the same pattern as #5563 (grok-cli: 200), integrated in v3.8.43.
This commit is contained in:
Luis Alejandro Vega
2026-07-05 02:30:04 -03:00
committed by GitHub
parent 6a12ba07b1
commit 0ed6780798
2 changed files with 10 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ const DEFAULT_LIMIT = MAX_TOOLS_LIMIT;
const PROVIDER_TOOL_LIMITS: Record<string, number> = {
"grok-cli": 200,
"nvidia": 1536,
};
const _detectedLimitsSweep = setInterval(() => {

View File

@@ -69,6 +69,15 @@ describe("toolLimitDetector", () => {
assert.strictEqual(getEffectiveToolLimit("grok-cli"), 200);
});
it("should return proactive limit for nvidia (1536) without any detection", () => {
assert.strictEqual(getEffectiveToolLimit("nvidia"), 1536);
});
it("should not override nvidia proactive limit with reactive detection", () => {
setDetectedToolLimit("nvidia", 100);
assert.strictEqual(getEffectiveToolLimit("nvidia"), 1536);
});
it("should still return default (128) for unknown providers", () => {
assert.strictEqual(getEffectiveToolLimit("some-new-provider"), 128);
});