Search code
search_codeSearch tracked repository files for a literal string or POSIX regex, in the working tree or a specific commit. Skips binaries and policy-hidden paths.
Instructions
Search tracked files for a string or regex (git grep). Searches the working tree by default, or a specific commit with ref. Binary files and files hidden by the server's path policy are skipped. Prefer a literal query; set regex for POSIX extended regular expressions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | No | Commit, branch or tag to search. Omit for the working tree. | |
| query | Yes | ||
| regex | No | Treat `query` as a POSIX extended regex. | |
| pathGlobs | No | Only search matching paths, e.g. `src/**/*.ts`. `*` does not cross `/`. | |
| maxResults | No | ||
| contextLines | No | ||
| caseSensitive | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | Yes | Resolved commit SHA, or null for the working tree. | |
| matches | Yes | ||
| truncated | Yes | True if there were more matches than were returned. |