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
list_directory emits byte sizes on every entry by default #767
That is roughly 8-10 tokens per entry for information that is rarely load-bearing when the model is just orienting itself in a directory. On a 50-entry listing it is 400-500 tokens, and on a recursive listing it multiplies.
The information is already available on demand through read_file with metadata_only: true.
There is also an lstat call per file (source/tools/list-directory.tsx:96-102) purely to get the size, so dropping it by default is a small wall-clock win on large directories too.
Fix
Make sizes opt-in behind a showSizes boolean on the tool schema, defaulting to false. Skip the lstat when it is false.
The tool description at source/tools/list-directory.tsx:188 says "List directory contents with file sizes", so that needs updating to match.
Notes for a first-time contributor
Contained to one file. Add the flag to the ListDirectoryArgs interface and the inputSchema, gate the lstat and the size string on it, update the description. Tests in source/tools/list-directory.spec.tsx.
Activity
will-lamerton commentedon Aug 3, 2026
Part of #772.
feat: make list_directory file sizes opt-in via showSizes