Nilux AI

Glob Tool

The Glob tool finds files by name pattern. It is the fastest way to locate files by extension, naming convention, or directory structure. Results are sorted by modification time (most recently modified first), helping you quickly find recently changed files.

Parameters

ParameterTypeRequiredDescription
search_patternstringYesGlob pattern to match file paths
search_pathstringNoDirectory to search within (default: project root)

Pattern Syntax

Glob supports the full range of standard pattern syntax:

SyntaxDescriptionExample
*Match any characters in a single path segment*.ts matches utils.ts, index.ts
**Match any characters across path segments (recursive)**/*.test.ts matches all test files anywhere
?Match a single characterpage?.tsx matches page1.tsx, pageA.tsx
[abc]Match any character in bracketsfile[0-9].txt matches file1.txt, file2.txt
{a,b}Match either pattern (brace expansion)*.{ts,tsx} matches all TypeScript files

Usage Examples

Find by Extension

> Find all TypeScript files in the project

Agent invokes Glob:
  search_pattern: **/*.ts

Result:
  src/index.ts
  src/lib/utils.ts
  src/components/Button.tsx
  src/__tests__/utils.test.ts
  ... (92 files)

Find in Specific Directory

> What's in the components directory?

Agent invokes Glob:
  search_pattern: *
  search_path: src/components

Result:
  src/components/Button.tsx
  src/components/Header.tsx
  src/components/Sidebar.tsx
  src/components/Footer.tsx

Find by Naming Convention

> Find all test files

Agent invokes Glob:
  search_pattern: **/*.test.{ts,tsx}

Result:
  src/__tests__/auth.test.ts
  src/__tests__/utils.test.ts
  src/__tests__/components/Button.test.tsx
  ... (15 files)

Find Configuration Files

> Find all config files at any depth

Agent invokes Glob:
  search_pattern: **/*config*.*

Result:
  next.config.ts
  tailwind.config.ts
  vitest.config.ts
  .eslintrc.config.js

Sorting

Results are sorted by modification time, with the most recently modified files appearing first. This is useful for:

  • Finding files that were recently changed
  • Identifying active areas of the codebase
  • Checking what was modified in the current work session

Limits

  • Maximum 100 files returned per call
  • If more files match, results are truncated — narrow your pattern or use search_path to scope the search
  • Common non-source directories are automatically excluded

Excluded Directories

The following directories are automatically excluded to keep results focused on source files:

  • node_modules
  • .git
  • dist
  • build
  • __pycache__
  • venv
  • .next
  • coverage
  • And other common build/output directories

When to Use Glob vs Grep

Use Glob when...Use Grep when...
You know the file name patternYou know the content you're looking for
Finding files by extensionFinding which files contain a function
Discovering project structureSearching for a specific import
Locating config/test filesFinding all usages of a variable

Tip: Glob and Grep are often used together. First use Glob to find candidate files, then use Grep to find specific content within them, or Read to examine them.

Common Patterns

Find all source files in a language:

**/*.ts          # TypeScript
**/*.py          # Python
**/*.go          # Go
**/*.rs          # Rust

Find specific file types:

**/*.{ts,tsx}    # All TypeScript + TSX
**/*.{css,scss}  # All stylesheets
**/*.{json,yaml} # Config files

Find files at a specific depth:

src/*/index.ts   # index.ts one level deep in src
src/**/index.ts  # index.ts at any depth in src

Find recently modified Markdown:

**/*.md           # All markdown files (sorted by mtime)

Scoped search:

*.test.ts         # Files ending with .test.ts in root only
**/*.test.ts      # Files ending with .test.ts anywhere

Next Steps

  • Grep — Searching file contents with regex
  • Read — Reading files found by Glob
  • Tools Overview — All available tools