disks/usage
Measure disk space used by a directory tree, with options for depth, exclusions, apparent sizes, and JSON output; read-only and can run privileged for unreadable paths.
Instructions
Measures how much disk space a directory tree uses (native walk, like du). Read-only. For the free space of a whole filesystem use disks/free; to find individual big files use files/find with size. By default the reply is one grand total; max_depth: N also lists directories up to N levels deep, largest first; all: true adds a per-file list (text output only). Sizes are allocated blocks unless apparent_size: true; hard links count once, symlinks are never followed. exclude patterns containing / match the full path (/proc, /var/lib/*), others the base name. Unreadable directories are skipped silently, so an unprivileged total can under-count: use privileged: true (a grant with a paths: entry). Results are cached for 60 s per user and arguments. The shipped config allows 300 s, otherwise the default is 30 s. Text ends with Total size of PATH: N; output_format: json returns an object (path, total_size, human_size with human_readable, directory_sizes as a path-to-bytes map only when max_depth > 0).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| all | No | Also list every file, largest first (text output only) | |
| path | Yes | Absolute path of the directory to measure | |
| exclude | No | Patterns to skip: one containing '/' matches the full path (e.g. '/proc', '/var/lib/*'), others the base name (e.g. '*.tmp') | |
| max_depth | No | 0 or omitted: grand total only; N: also list directories up to N levels deep, largest first | |
| threshold | No | Bytes: a positive value hides entries smaller than this, a negative value hides larger ones (printed lines only) | |
| privileged | No | Run as root. Needs a grant for this tool in mcp-sudo.yaml and a `paths:` entry covering the path, otherwise refused | |
| apparent_size | No | Report logical file sizes instead of allocated disk blocks | |
| output_format | No | Use json for structured output (yaml, table and wide return the same JSON); default is text | |
| separate_dirs | No | For directories do not include size of subdirectories (-S) | |
| human_readable | No | Sizes like du -h (4.0 KiB); default is bytes | |
| one_file_system | No | Skip directories on different file systems (-x) |