Search workspace
searchLocate files, directories, code strings, or symbol definitions across a workspace by name or content, and rank matching lines with weighted patterns before reading.
Instructions
Search by kind: file_name, directory_name, literal_content (regex=true for regex) or definition (symbol declarations). queries instead ranks matching lines by several weighted patterns (must/weight).
Use when: you must locate code, strings or symbols before reading. Keep relative_path narrow: a scan stops at 50000 files.
Avoid when: you know the path (read_file), want a file's structure (outline_symbol), a symbol's usages (symbol_references) or an executable on PATH (shell_run: where <name>).
Output: hits[] {relative_path, line_number, snippet}, complete, total_match_lines, files_matched. With queries: hits also carry score/matched, plus total_files/total_hits. No match is ok with empty hits.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "search"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| glob | No | rg glob filter ('*.ts' = any depth, 'tools/*.ts' = that dir). | |
| kind | No | name substring | content (substring, or regex when regex=true) | declaration lines. Required unless `queries`/`files_hint` is set. | |
| limit | No | Max hits returned (default and max 200; ignored when count_only=true). | |
| query | No | What to find (meaning depends on kind). Required unless `queries`/`files_hint` is set. | |
| regex | No | true treats query as a regular expression for literal_content/definition (default false = plain substring). | |
| hybrid | No | true = tag hits with source/confidence; literal_content only. | |
| queries | No | Rank matching lines by several patterns: each matching pattern adds its weight to the line's score, and `must` patterns have to match. When set, `kind` and `query` are ignored and hits carry `score`/`matched`. Combine with `files_hint` to scan specific files. | |
| count_only | No | true returns only match counts; limit is then ignored. false (default) returns hits. | |
| files_hint | No | Workspace paths to search when `queries` is set (first 20 are used). Omit to scan a shallow listing of `relative_path` instead. | |
| whole_word | No | true = whole-word match only (rg -w / JS word boundaries) for literal_content and definition. | |
| exclude_glob | No | rg glob exclusion (same dialect as glob). | |
| context_lines | No | Context lines around each hit (default 0). | |
| relative_path | No | Workspace-relative ('.' = root); absolute/.. outside it rejected. | |
| case_sensitive | No | true makes literal_content/definition matching case-sensitive (default false). | |
| include_hidden | No | true = include hidden files (default); false = skip dotfiles. Secrets always excluded. |