find_wrapper_callers
Identify C/C++ wrapper classes that call driver methods, revealing adapter patterns like UART wrapping UART_DRIVER. Uses libclang to trace method ownership across classes.
Instructions
Find C/C++ wrapper classes that call methods of a driver class —
libclang-powered adapter pattern detection. Traces method ownership
across class boundaries to reveal the wrapper/adapter architecture
(e.g. UART wraps UART_DRIVER). Text-based search cannot
distinguish which class owns each method call.
Returns wrapper methods grouped by wrapper class, showing which driver
methods each wrapper calls. Useful for understanding the adapter/wrapper
architecture (e.g. UART wraps UART_DRIVER).
For the reverse perspective — finding who calls a specific driver method
— use find_callers. For class member listing use
get_class_members.
Read-only. No side effects. Requires the reference index
(fw-context index — refs on by default).
Args:
class_name: Driver class name to find wrappers for.
E.g. 'UART_DRIVER' or 'hal::UART_DRIVER'.
project_root: Project root. Auto-detected if omitted.
project: Project name or project_id — call list_projects to get them. Use
it to ask about a project that is not the project of the current
directory. It is an alternative to project_root, which takes a root
path. Give one of the two, not both.
limit: Maximum wrapper method results (default 50, max 50).
variant: Build variant (multi-build project). Omit to use
default_variant. One query answers for ONE build.
image: Sysbuild image within the variant. Required when the
variant holds several: each image is a separate program.
Returns:
list of dicts, each with: wrapper_class (str — "(global)" for a
free function), method_count (int),
methods (list of dicts — each with method, qualified_name, kind,
file (str — absolute path of the file that holds the body of that
method), and calls (list of dicts — driver_method (str) and
line (int) of each call into the driver))).
The path sits on the method, not on the class, because one wrapper
class often spans several files.
Never empty: one dict with ``error`` (cannot resolve) or ``info``
(no results) replaces the results. Check both keys first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| image | No | Sysbuild image within the variant. Required when the variant holds several: each image is a separate program. | |
| limit | No | Maximum wrapper method results (default 50, max 50). | |
| project | No | Project name or project_id — call list_projects to get them. Use it to ask about a project that is not the project of the current directory. It is an alternative to project_root, which takes a root path. Give one of the two, not both. | |
| variant | No | Build variant (multi-build project). Omit to use default_variant. One query answers for ONE build. | |
| class_name | Yes | Driver class name to find wrappers for. E.g. 'UART_DRIVER' or 'hal::UART_DRIVER'. | |
| project_root | No | Project root. Auto-detected if omitted. This field also accepts a project name or a project_id, but project is the clear field for those. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |