Skip to content

fix(tools): recover provider-truncated tool names - #29

Merged
ImPedro29 merged 4 commits into
verbeux-ai:mainfrom
guustavomv:fix/read-plan-tool-name-truncation
Aug 9, 2026
Merged

ImPedro29 merged 4 commits into
verbeux-ai:mainfrom
guustavomv:fix/read-plan-tool-name-truncation

Conversation

@guustavomv

Copy link
Copy Markdown

Summary

Some providers emit tool calls with truncated tool names (e.g. ReadRea, EnterPlanModeEnterPlanMo). The executor failed those with No such tool available: <name>, forcing the model to retry or give up on tools like Read/EnterPlanMode.

  • findToolByNameOrUniquePrefix (Tool.ts): when an exact name lookup fails, recover via prefix matching — only when the prefix is unambiguous, never for MCP tool names, and only for names ≥ 3 chars.
  • Unique one-character completion: Rea recovers as Read even when the deferred ReadMcpResourceTool is also registered (a longer prefix match).
  • Fallback after permission filtering (StreamingToolExecutor): recover truncated names against base tools when the definition was filtered out of the model's available set.
  • Same recovery in runToolUse (toolExecution.ts) for the direct-execution path.

Also includes fix(tools): restore findToolByName import for interrupt handling7523ea3 swapped the import but getToolInterruptBehavior still calls findToolByName, which would throw a ReferenceError on the cancel/interrupt path.

Test plan

  • bun test ./src/Tool.test.ts — 3 pass (new recovery cases)
  • bun test ./src/services/tools/ — 12 pass across 4 files (Tool, StreamingToolExecutor tool pairing, toolExecution, tool result pairing)

Notes

  • Deliberately does not guess MCP tool names or accept prefixes < 3 chars / ambiguous prefixes.
  • Trade-off: a unique one-character completion can pick a shorter tool when the model meant a longer one; bounded and documented in code.

Gustavo Miranda and others added 4 commits August 9, 2026 11:32
7523ea3 swapped the tool lookup import to findToolByNameOrUniquePrefix
but getToolInterruptBehavior still calls findToolByName, which would
throw a ReferenceError on the cancel/interrupt path. Re-add the import.
@ImPedro29
ImPedro29 merged commit b5d27bb into verbeux-ai:main Aug 9, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants