search_code
Find code patterns using grep and enrich results with a knowledge graph to deduplicate matches into functions, rank by importance, and limit by scope filters.
Instructions
Graph-augmented code search. Finds text patterns via grep, then enriches results with the knowledge graph: deduplicates matches into containing functions, ranks by structural importance (definitions first, popular functions next, tests last). Modes: compact (default, signatures only — token efficient), full (with source), files (just file paths). Use path_filter regex to scope results. TRUNCATION: enriched results are capped at limit (default 10). Response carries 'total_grep_matches' (raw grep hit count) and 'total_results' (deduplicated function count) — compare to limit to detect truncation. There is no offset parameter; to see more, raise limit or narrow the query with file_pattern / path_filter.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pattern | Yes | ||
| project | Yes | ||
| file_pattern | No | Glob for grep --include (e.g. *.go) | |
| path_filter | No | Regex filter on result file paths (e.g. ^src/ or \.(go|ts)$) | |
| mode | No | compact: signatures+metadata (default). full: with source. files: just file list. | compact |
| context | No | Lines of context around each match (like grep -C). Only used in compact mode. | |
| regex | No | ||
| limit | No | Max enriched results per call. Default 10. Response includes 'total_grep_matches' and 'total_results' so callers can detect truncation. No offset parameter — raise limit or narrow with file_pattern / path_filter to see more. |