From bc8c90de93f128065c40a47bbbf32bc6a7463ba4 Mon Sep 17 00:00:00 2001 From: dj-oyu <68707227+dj-oyu@users.noreply.github.com> Date: Mon, 2 Mar 2026 04:23:04 +0900 Subject: [PATCH] fix: include available tool names in "tool not found" error message When the LLM calls a non-existent tool, the error message now lists all available tools so the LLM can self-correct on the next iteration instead of blindly guessing names (observed 7+ wasted iterations in heartbeat). Co-Authored-By: Claude Opus 4.6 --- pkg/tools/registry.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/tools/registry.go b/pkg/tools/registry.go index 6fa7b0dea..1d428704f 100644 --- a/pkg/tools/registry.go +++ b/pkg/tools/registry.go @@ -82,11 +82,14 @@ func (r *ToolRegistry) ExecuteWithContext( tool, ok := r.Get(name) if !ok { + available := strings.Join(r.List(), ", ") logger.ErrorCF("tool", "Tool not found", map[string]any{ "tool": name, }) - return ErrorResult(fmt.Sprintf("tool %q not found", name)).WithError(fmt.Errorf("tool not found")) + return ErrorResult(fmt.Sprintf( + "tool %q not found. Available tools: %s", name, available, + )).WithError(fmt.Errorf("tool not found")) } // If tool implements ContextualTool, set context