explain_symbol
Explain C/C++ symbols in plain English: purpose, inputs, outputs, and side effects. Uses pre-computed analysis when available, falling back to on-demand LLM or macro explanation.
Instructions
Explain what a C/C++ symbol does in plain English — libclang-aware
analysis. Uses pre-computed LLM analysis when available (instant),
falls back to on-demand LLM. Falls back to macro explanation when
the name matches a #define.
Read-only. No side effects — uses pre-computed LLM analysis when available
(instant, generated during fw-context index --analyze), falls back to
calling an LLM on-demand. Returns the symbol's purpose, inputs, outputs,
and side effects.
For raw source code use get_source. For symbol metadata without
explanation use lookup_symbol. For body + callers + callees use
get_symbol_context.
Args:
name: Symbol name to explain. E.g. uart_init, ModemMsg::send.
project_root: Project root directory. Auto-detected if omitted.
context_lines: Lines of source context around the symbol definition
(default 40, max 200). Only used when no pre-computed analysis exists.
Returns:
dict: {name, kind, file, line, signature, explanation, llm_analysis
(if pre-computed)}, plus source/explain_prompt on fallback. Macro
fallback returns kind="macro", signature (as #define NAME),
value (raw definition), and expanded_value.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Symbol name to explain. E.g. 'uart_init', 'ModemMsg::send'. | |
| image | No | Sysbuild image name within the variant (multi-project). Omit for all images of the variant. | |
| variant | No | Build variant name (multi-project). Omit to use default_variant or fail-closed. Use '*' for all variants. | |
| project_root | No | Project root. Auto-detected if omitted. | |
| context_lines | No | Lines of source context around the symbol definition. |