cos_graph_query
Look up a symbol by its short term, path, or UID in a code graph. Returns matching nodes with optional filters and expansion.
Instructions
Look up a symbol by a KNOWN short term, path, or uid (lexical + graph expansion). For a natural-language DESCRIPTION of code whose name you don't know, use cos_graph_search instead.
TIP: prefer SHORT terms ("sdk_dispatcher", "ClaudeSDKDispatcher.dispatch") or a literal path / uid. Long natural-language queries return weaker matches because the index is built from labels + docstrings, not free text.
UID scheme (also accepted as q):
code:file: · code:function::: · code:class:::
code:method:::. · code:module:
doc:file: · doc:heading:#: · folder:
When the query looks like a path or uid and the lexical pass returns nothing, the tool falls back to a direct uid lookup so the agent gets a single-item hit instead of empty results.
Args: q: Short term, path, or uid (non-empty). NL queries work but degrade. kinds: Comma-separated filter of node kinds (e.g. "function,class,method"). Empty = all. limit: Max results (default 10). max_hops: Walk expansion depth (default 2). confidence_min: Edge confidence floor (default 0.3). include_spine: S3 — attach the CONTAINS-ancestor chain to each result for breadcrumbs.
Returns:
JSON envelope with results array. See docs/engineering/graph_os-queries.md.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| q | Yes | ||
| kinds | No | ||
| limit | No | ||
| max_hops | No | ||
| include_spine | No | ||
| confidence_min | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |