search_code
Find code by meaning, not just exact strings. Search across indexed repositories to understand flows, plan changes, and locate implementations by behavior.
Instructions
PRIMARY code-search tool — use FIRST for any question about how indexed code works, to plan a change, trace a flow, or find an implementation by behavior. Prefer this over grep/Read for indexed repos: grep needs exact strings, this finds code by meaning. Embeds the query, vector-searches Milvus, expands via Neo4j graph neighbors (callers/callees/imports/inheritance) and community summaries, reranks, returns chunks with file_path, start_line, end_line, snippet, score. Each chunk carries a citation field (e.g. 'repo@sha12:path') and the response includes a top-level sources map with commit_sha and permalink_base per source for building file-level permalinks. top_k defaults to 5 (the benchmarked sweet spot) — raise it only when a first search shows the answer spans many files. Optional filter: language (e.g. 'python'). SCOPE IS REQUIRED: pass source_id (from list_indexed_sources) or path_prefix (e.g. '/repo/src/') to scope to one repo, OR cross_repo=true to search the whole multi-repo index — exactly one, not both, or the search is rejected. Set check_staleness=true to add an is_stale flag per source (does live git HEAD resolution — slightly slower). response_mode (opt-in, default 'full'): 'facet' returns ranked metadata + a one-line header per hit with NO code body (cheaper — then fetch ranges with read_file); 'summary_tail' keeps the top-2 snippets and replaces lower-ranked bodies with their indexed one-line summary. Returns compact markdown by default (~20% fewer tokens); pass response_format='json' to get the structured dict instead (for programmatic callers).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| top_k | No | ||
| language | No | ||
| use_hyde | No | ||
| source_id | No | ||
| cross_repo | No | ||
| use_hybrid | No | ||
| path_prefix | No | ||
| rerank_pool | No | ||
| adaptive_topk | No | ||
| response_mode | No | full | |
| strip_imports | No | ||
| check_staleness | No | ||
| response_format | No | markdown | |
| adaptive_topk_gap | No | ||
| use_graph_scoring | No | ||
| use_summary_vector | No | ||
| query_class_payload | No | ||
| include_community_summaries | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |