Skip to content

Commit 7746a80

Browse files
committed
v0.52.2 — Actionable directory-error messages
When read_file, batch_read, or count_lines receive a directory path instead of a file, the error now suggests the correct tool: tree, glob, search_files(target='files'). Prevents LLM from abandoning the tool entirely after hitting a directory.
1 parent d0c2854 commit 7746a80

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

cmd/odek/file_tool.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func (t *readFileTool) Call(argsJSON string) (string, error) {
119119
return jsonError(fmt.Sprintf("cannot stat %q: %v", args.Path, err))
120120
}
121121
if info.IsDir() {
122-
return jsonError(fmt.Sprintf("%q is a directory, not a file", args.Path))
122+
return jsonError(fmt.Sprintf("%q is a directory — use tree or search_files(target='files') to list its contents, or glob(pattern='*', path=%q) to find files inside it", args.Path, args.Path))
123123
}
124124

125125
// Single pass: binary check from sample → seek → read+count
@@ -926,7 +926,7 @@ func (t *batchReadTool) readSingle(arg batchReadFileArg) batchReadFileResult {
926926
return batchReadFileResult{Path: arg.Path, Error: fmt.Sprintf("cannot stat %q: %v", arg.Path, err)}
927927
}
928928
if info.IsDir() {
929-
return batchReadFileResult{Path: arg.Path, Error: fmt.Sprintf("%q is a directory, not a file", arg.Path)}
929+
return batchReadFileResult{Path: arg.Path, Error: fmt.Sprintf("%q is a directory — use tree or search_files(target='files') to list its contents", arg.Path)}
930930
}
931931

932932
// Binary check from sample

cmd/odek/perf_tools.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ func (t *countLinesTool) countFile(path string) (entry countFileEntry) {
947947
return countFileEntry{Path: path, Error: fmt.Sprintf("cannot stat %q: %v", path, err)}
948948
}
949949
if info.IsDir() {
950-
return countFileEntry{Path: path, Error: fmt.Sprintf("%q is a directory", path)}
950+
return countFileEntry{Path: path, Error: fmt.Sprintf("%q is a directory — use tree or glob to explore directories", path)}
951951
}
952952

953953
lines := 0

0 commit comments

Comments
 (0)