get_template_instances
Finds all concrete instantiations of a C/C++ template across translation units, using libclang to resolve specializations. Returns full type signatures and the template declaration.
Instructions
Find all template instantiations for a C/C++ class or function template — libclang template-aware lookup. Finds concrete instantiations spread across all translation units, each with its full type signature. Text-based search cannot resolve template specializations across translation units.
Returns concrete instantiations of the template — each with its full type
signature (e.g. Callback<void(int)>). The template declaration itself
is also returned as the first result when found.
Uses the template_usr column populated during indexing via libclang's
cursor.specialized_template.
For finding the template declaration itself use lookup_symbol.
Read-only. No side effects.
Args:
template_name: Template name to find instantiations for.
E.g. 'Callback' or 'mbed::Callback'.
project_root: Project root. Auto-detected if omitted.
limit: Maximum results (default 50).
Returns: list[dict] with one element wrapping the template declaration: {name, qualified_name, kind, file, line, is_definition, signature, instances (list of dicts, each with name, qualified_name, kind, file, line, signature, is_definition), instance_count (int)}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum results (default 50). | |
| project_root | No | Project root. Auto-detected if omitted. | |
| template_name | Yes | Template name to find instantiations for. E.g. 'Callback' or 'mbed::Callback'. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |