lookup_symbol
Look up C/C++ symbols by exact name or prefix match via libclang index, uncovering build-conditional code, template instantiations, and macro-expanded names that grep cannot detect.
Instructions
USE INSTEAD OF grep, ctx_search, or ctx_symbol. Look up a C/C++ symbol by name via libclang index — exact or prefix matching.
Finds symbols grep cannot see: build-conditional code, template
instantiations, macro-expanded names. Prefer this over search_code when
you know the exact symbol name or a prefix (uart_ finds all UART
symbols). Use search_code for keyword/concept search.
Read-only: yes. May auto-reindex stale files (non-blocking).
Args: name: Symbol name (exact match) or prefix (set exact=False). E.g. 'uart_init' finds the exact function; 'uart_' finds all symbols starting with 'uart_'. project_root: Project directory. Auto-detected if omitted. exact: True = exact name match, False = prefix LIKE match (default). limit: Maximum results (default 50).
Returns:
list[dict]: Symbols with name, qualified_name, kind, file, line,
signature, docstring, is_definition, is_template, is_virtual,
is_pure_virtual fields. Enum constants include enum_value
with the integer value. May also include template_usr,
parent_usr, summary, inputs, outputs when available.
When no results found, may include _did_you_mean with suggested
symbol names. Empty list if not found.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Symbol name. Exact match if exact=True, prefix LIKE match otherwise. E.g. 'uart_init' or 'uart_'. | |
| exact | No | True = exact name match, False = prefix LIKE match (default). | |
| limit | No | Maximum results returned (capped at 100, default 50). | |
| project_root | No | Project root directory. Auto-detected from CWD if omitted. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |