Skip to main content

Module list_dir

Module list_dir 

Source
Expand description

list_dir tool — list the entries of a single directory.

Why: Complements glob/grep (#1027) — the cheapest discovery primitive is “what’s in this directory?”, which the engineer previously could only get by shelling out to ls. A structured, non-recursive listing lets the model orient itself in one typed call instead of a bash round-trip. What: ListDirTool reads one directory (default: the working-directory root) and returns its immediate entries, each tagged as a directory (name/) or a file (name). Non-recursive by design — recursion is glob’s job. Test: See #[cfg(test)] below — covers a mixed listing, subdirectory listing, missing directory, not-a-directory, and path traversal.

Structs§

ListDirTool
ToolExecutor that lists the immediate entries of a directory.