file_search
Searches for files matching a glob pattern. Results are sorted by modification time (most recent first).Glob pattern to match files. Examples:
"**/*.ex"- All Elixir files"lib/**/*.ex"- Elixir files in lib/"test/*_test.exs"- Test files in test/ (non-recursive)"*.{ex,exs}"- Files with multiple extensions
Directory to search in, relative to project root. Defaults to project root.
Returns
Success response includes:- Count of matching files
- List of relative file paths (sorted by modification time, newest first)
Excluded Directories
The following directories are automatically excluded from search:.git_builddepsnode_modules.elixir_ls.lexical
Usage Examples
content_search
Searches file contents for lines matching a regex pattern. Returns matches with file paths and line numbers.Regex pattern to search for. Supports full Elixir/PCRE regex syntax:
"defmodule.*Router"- Modules containing “Router”"def \\w+"- Function definitions"TODO|FIXME"- Multiple alternatives"@spec.*String.t"- Type specs with String
Directory to search in, relative to project root. Defaults to project root.
File filter glob pattern:
"*.ex"- Only .ex files"*.{ex,exs}"- Multiple extensions"*_test.exs"- Test files
/ or start with **, it’s automatically prefixed with **/.Returns
Success response includes:- Count of matches
- Truncation notice if 100+ matches found
- Matches formatted as
file:line_number:content
Limits
Usage Examples
Error Handling
Invalid regex patterns return descriptive errors:directory_list
Lists directory contents with file metadata (type, size, modification time).Directory path relative to project root
Returns
Success response includes:- Directory path and entry count
- Formatted listing with metadata
Format Details
File Types
File Types
file- Regular filedir- Directory (shown with trailing/)link- Symbolic link???- Unknown type
Size Formatting
Size Formatting
- Bytes:
123B - Kilobytes:
45KB(1024+ bytes) - Megabytes:
1.2MB(1048576+ bytes)
Timestamps
Timestamps
Format:
YYYY-MM-DD HH:MMBased on file modification time (mtime).Usage Examples
Error Cases
enoent
Directory not found
enotdir
Path is a file, not a directory
Common Search Patterns
Find Module Definitions
Find Test Files
Find Config Files
Find Documentation
Implementation Details
Search tools are implemented inlib/loom/tools/:
file_search.ex- Source: lib/loom/tools/file_search.ex:1content_search.ex- Source: lib/loom/tools/content_search.ex:1directory_list.ex- Source: lib/loom/tools/directory_list.ex:1