ctx_search

Core Tools

Search code; `action` picks the engine (default regex). regex(pattern) | semantic(query, by meaning) | symbol(name, AST-exact; or handle=path#name@Lline) | reindex | find_related(file_path,line). anchored=true tags hits for ctx_patch. Run ctx_compose FIRST.

Parameters
16
Required
0
Actions
5
Token Impact
~1200 tokens saved vs reading full files for typical search results.

Parameters

Parameter Type Required Description
action "regex" | "semantic" | "symbol" | "reindex" | "find_related" No -
anchored boolean No -
file string No -
file_path string No -
handle string No path#name@Lline (exact, stable)
include string No Glob, e.g. *.rs
kind string No fn|struct|class|trait|enum
line integer No -
max_results integer No -
mode "bm25" | "dense" | "hybrid" No -
name string No -
path string No Scope dir/root
paths array No -
pattern string No -
query string No -
top_k integer No -

Actions

regex

ctx_search action="regex"

semantic

ctx_search action="semantic"

symbol

ctx_search action="symbol"

reindex

ctx_search action="reindex"

find_related

ctx_search action="find_related"

Call shape

Derived from the input schema: required parameters, plus the most common optional ones.

ctx_search(action="regex", anchored=true)

Examples

Regex search across a directory

ctx_search pattern="fn handle_" path="src/"

Returns compact file:line hits for every regex match instead of the full files, with deterministic ordering.

Filter by file type with an include glob

ctx_search pattern="TODO" path="src/" include="*.rs"

The include glob narrows the search to matching files (e.g. *.ts, src/**/*.rs) and replaces the deprecated ext parameter.

Search several roots at once

ctx_search pattern="ApiError" paths=["crates/core", "crates/api"]

Pass multiple roots via paths to search across modules in a single ranked result set.

Related Tools

Schema MD5: 43a92bbda1d4a5d95d30031aea65220b3c8beee2676c71ad58a62a0c98c05418 ← Back to all tools