Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Search Tools

find_files

Find files matching a glob pattern.

Permission: Read

Parameters

NameTypeRequiredDescription
patternstringyesGlob pattern to match files against
pathstringnoDirectory to search in (defaults to current directory)

Glob Patterns

PatternMatches
*.rsAll .rs files in the current directory
**/*.rsAll .rs files recursively
src/*.txtAll .txt files in src/
test_*All files starting with test_

Examples

agsh [r] > find all Rust source files in this project
agsh [r] > find all configuration files (*.toml, *.yaml, *.json) in this repo

search_contents

Search file contents using a regex pattern. Powered by the ripgrep library.

Permission: Read

Parameters

NameTypeRequiredDescription
patternstringyesRegex pattern to search for
pathstringnoFile or directory to search in (defaults to current directory)
globstringnoGlob pattern to filter which files are searched (e.g., *.rs)

Behavior

  • Searches recursively through directories.
  • Skips hidden files (starting with .) and common non-text directories (target, node_modules).
  • Results are limited to 100 matches to avoid overwhelming the LLM context.
  • Each result includes the file path, line number, and matching line.

Examples

agsh [r] > search for all TODO comments in this project
agsh [r] > find all uses of "unwrap()" in Rust files

The agent will call search_contents with pattern: "unwrap\\(\\)" and glob: "*.rs".

agsh [r] > search for the string "API_KEY" in all .env files