list_locations
Find file and line numbers for all occurrences of a pattern. Returns array of path and line objects for efficient location enumeration.
Instructions
Cheapest way to find every place a pattern occurs. Prefer this over Glob-based path hunting and over Grep when you only need file + line numbers (no previews). Returns an array of {path, line} objects — one per match, no limit.
Use this for: enumerating locations before deciding which files to Read; counting affected sites; listing all hits of a pattern without paying for previews. Supports lang, file, glob, exclude filters.
Example: pattern: "CourtCase" → [{"path": "app/Models/CourtCase.php", "line": 15}, {"path": "app/Http/Controllers/CourtController.php", "line": 42}]. On "Index not found" / "stale" error, call index_project, then retry.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | No | Filter by file path substring (e.g., 'Controllers') | |
| glob | No | Include files matching patterns (e.g., ['app/**/*.php']) | |
| lang | No | Filter by language (php, rust, typescript, python, etc.) | |
| force | No | Force execution of potentially expensive queries (bypasses broad query detection) | |
| exclude | No | Exclude files matching patterns (e.g., ['vendor/**', 'tests/**']) | |
| pattern | Yes | Search pattern (text to find) | |
| dependencies | No | Include dependency information (imports) in results. Only extracts static imports. |