code_search & code_grep
Two search tools — pick based on what you know.
code_grep — pattern matching
Section titled “code_grep — pattern matching”Searches indexed file contents by regex pattern. Fast, deterministic, no LLM involved.
code_grep(pattern="TODO", max_results=10)code_grep(pattern="stripe\.charges\.create")code_grep(pattern="process\.env\.[A-Z_]+")Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
pattern | string | required | Regex pattern |
max_results | number | 20 | Cap on returned matches |
code_search — semantic search
Section titled “code_search — semantic search”Finds symbols by name or natural language description. Routes automatically to the right tool.
code_search(query="payment processing")code_search(query="the function that validates JWT tokens")code_search(query="UserService")When to use which
Section titled “When to use which”| You know… | Use |
|---|---|
| Exact string or regex | code_grep |
| Symbol name | code_search |
| A concept (“the auth middleware”) | code_search |
| All TODO comments | code_grep(pattern="TODO") |