You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Auto-trim tool names in experimental_repairToolCall #24924
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Problem:
Some models (e.g., kimi-k2.5) occasionally generate tool calls with leading/trailing whitespace in the tool name (e.g., ' bash' instead of 'bash'). This causes the SDK to throw "Model tried to call unavailable tool ' bash'" errors, even though the tool exists.
Current Behavior:
The experimental_repairToolCall callback only handles case mismatches (e.g., 'Bash' → 'bash'), but not whitespace issues.
Proposed Solution:
Automatically trim whitespace from tool names before validation, or provide a built-in repair mechanism similar to case-insensitive matching.
This issue might be a duplicate of an existing issue. Please check:
[bug] Failure to call a tool due to an extra space in the tool name. #4279: Same root cause — Kimi K2 (and similar models) generating tool names with leading/trailing whitespace (e.g., ' bash' instead of 'bash'), causing tool call failures. That issue also references the same model and identical symptom.
If your feature request adds something beyond what's already tracked in #4279, please clarify the distinction there or here so maintainers can decide whether to merge or keep them separate.
Activity
github-actions commentedon Apr 29, 2026
This issue might be a duplicate of an existing issue. Please check:
' bash'instead of'bash'), causing tool call failures. That issue also references the same model and identical symptom.If your feature request adds something beyond what's already tracked in #4279, please clarify the distinction there or here so maintainers can decide whether to merge or keep them separate.