find_wrapper_callers
Detect C/C++ adapter patterns by finding wrapper classes that call a driver class's methods, tracing method ownership across class boundaries.
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'. The name
is case-sensitive. A bare name that names no top-level class
matches the class of that name in each namespace, but not a
class whose name only ends with it. The methods of a class
nested in the driver class count as driver methods.
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 classes on one page (default 20, max 100).
Each class comes with all of its methods and calls into the
driver (call and indirect references), thus a class is
never split over two pages.
offset: Skip this many wrapper classes. Reads the next page; the
page notice names the offset to use.
variant: Variant of the build (a board, or a PlatformIO
environment). On a project of more than one build, give the
arguments of one build as the refusal lists them: the
variant, the image, or the two. fw-context does not select a
build. One query answers for ONE build.
image: Image of the build: a separate program, such as the
application or the bootloader. Give it when the build has an
image name.
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.
The page notice ``{total, offset, shown, more, hint}`` comes
before the rows of the answer: ``total`` counts every wrapper class. A page after the last
class gives one ``info`` dict that names the total.
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 | Image of the build: a separate program, such as the application or the bootloader. On a project of more than one build, give it when that build has an image name, as the refusal lists it. | |
| limit | No | Maximum wrapper classes on one page (default 20, max 100). | |
| offset | No | Skip this many wrapper classes. Reads the next page. | |
| 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 | Variant of the build (a board, or a PlatformIO environment). On a project of more than one build, give the arguments of one build as the refusal lists them: the variant, the image, or the two. fw-context does not select a build for you. One query answers for ONE build. | |
| class_name | Yes | Driver class name to find wrappers for. E.g. 'UART_DRIVER' or 'hal::UART_DRIVER'. Case-sensitive. | |
| 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 |