> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sourcebot.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Code search

## `grep`

Searches for code matching a regular expression pattern across repositories, similar to `grep`/`ripgrep`. Always case-sensitive. Results are grouped by file and include line numbers.

Parameters:

| Name | Required | Description |
| :- | :- | :- |
| `pattern` | yes | The regex pattern to search for in file contents. |
| `path` | no | Directory path to scope the search to. Defaults to the repository root. |
| `include` | no | File glob pattern to include in the search (e.g. `*.ts`, `*.{ts,tsx}`). |
| `repo` | no | Repository name to search in. If not provided, searches all repositories. Use the full name including host (e.g. `github.com/org/repo`). |
| `ref` | no | Commit SHA, branch or tag name to search on. If not provided, defaults to the default branch. |
| `limit` | no | Maximum number of matching files to return (default: 100). |

## `glob`

Finds files whose paths match a glob pattern across repositories (e.g. `**/*.ts`, `src/**/*.test.{ts,tsx}`). Results are grouped by repository.

Parameters:

| Name | Required | Description |
| :- | :- | :- |
| `pattern` | yes | Glob pattern to match file paths against (e.g. `**/*.ts`, `src/**/*.test.{ts,tsx}`). |
| `path` | no | Restrict results to files under this subdirectory. |
| `repo` | no | Repository name to search in. If not provided, searches all repositories. Use the full name including host (e.g. `github.com/org/repo`). |
| `ref` | no | Commit SHA, branch or tag name to search on. If not provided, defaults to the default branch. |
| `limit` | no | Maximum number of files to return (default: 100). |

## `list_tree`

Lists files and directories from a repository path. Directories are shown before files at each level.

Parameters:

| Name | Required | Description |
| :- | :- | :- |
| `repo` | yes | The name of the repository to list files from. |
| `path` | no | Directory path (relative to repo root). If omitted, the repo root is used. |
| `ref` | no | Commit SHA, branch or tag name to list files from. If not provided, uses the default branch. |
| `depth` | no | Number of directory levels to traverse below `path` (min 1, max 10, default: 1). |
| `includeFiles` | no | Whether to include file entries in the output (default: true). |
| `includeDirectories` | no | Whether to include directory entries in the output (default: true). |
| `maxEntries` | no | Maximum number of entries to return before truncating (min 1, max 10000, default: 1000). |

## `read_file`

Reads the source code for a given file, with optional line range control for large files.

Parameters:

| Name | Required | Description |
| :- | :- | :- |
| `repo` | yes | The repository name. |
| `path` | yes | The path to the file. |
| `ref` | no | Commit SHA, branch or tag name to fetch the source code for. If not provided, uses the default branch. |
| `offset` | no | Line number to start reading from (1-indexed). Omit to start from the beginning. |
| `limit` | no | Maximum number of lines to read (max: 500). Omit to read up to 500 lines. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.