Search graph
search_graphReplace grep by searching a code knowledge graph with natural language, patterns, or semantic queries to find definitions and relationships.
Instructions
Search the code knowledge graph for functions, classes, routes, and variables. Use INSTEAD OF grep/glob when finding code definitions, implementations, or relationships. Three search modes: (1) query='update settings' for BM25 ranked full-text search with camelCase splitting and structural label boosting — recommended for natural-language discovery; (2) name_pattern='.regex.' for exact pattern matching; (3) semantic_query=[...] for vector cosine search that bridges vocabulary (finds 'publish' when you search 'send'). The three modes are independent and can be combined in a single call. RESPONSE: prefix-grouped tree rows by default — a shared (qn-prefix, file) group header printed once, then name label lines in out per row (full qn = group prefix + dot + name). in/out = selected degree across CALLS, USAGE, CALL_REFERENCE, INHERITS, and IMPLEMENTS; other edge types are excluded. These are NOT caller/callee counts — use trace_path for callers. Add per-node property columns via fields (e.g. ["complexity","signature","docstring"]); format="json" returns the SAME tree model as structured JSON. PAGINATION: results are capped at limit (default 50). The response always includes 'total' (full match count before limit) and 'has_more' (true when total > offset+returned). Detect truncation with has_more, then page by re-calling with offset=offset+limit until has_more is false. Narrow first via label/file_pattern/min_degree before paginating large result sets.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| label | No | ||
| limit | No | Max results per call. Default 50. Response carries 'total' (full match count) and 'has_more' (true if truncated) so callers can detect the limit and paginate. | |
| query | No | Natural-language or keyword full-text search using BM25 ranking. Tokens are split on whitespace; camelCase identifiers are indexed as individual words (updateCloudClient → update, cloud, client). Results are ranked with structural boosting: Functions/Methods +10, Routes +8, Classes/Interfaces +5. Noise labels (File/Folder/Module/Variable) are filtered out. When provided, name_pattern is ignored. | |
| detail | No | ids: bare qualified-name enumeration (one column) — cheapest form for wide sweeps where per-row metadata is noise. default: full rows. | default |
| fields | No | Extra per-node property columns, e.g. complexity, cognitive, signature, docstring, return_type, is_test, lines(int). Core row columns (qn/label/file/lines/in/out) are always present — do not request them here. Missing values emit as empty cells. | |
| format | No | Response encoding. tree (default): prefix-grouped text rows. json: the SAME tree model as structured JSON (groups + column-ordered row arrays). | tree |
| offset | No | Skip the first N matching nodes. Combine with 'limit' to page: increment offset by limit and re-call while has_more is true. | |
| project | Yes | ||
| max_degree | No | ||
| min_degree | No | ||
| qn_pattern | No | ||
| file_pattern | No | ||
| name_pattern | No | ||
| relationship | No | ||
| semantic_query | No | MUST be an ARRAY of keyword strings (e.g. ["send","pubsub","publish"]) — NOT a single string. Each keyword is scored independently via per-keyword min-cosine; results reflect functions that score well on ALL keywords. Requires moderate/full index mode. Results appear in the 'semantic_results' field (separate from 'results'). | |
| include_connected | No | ||
| exclude_entry_points | No |