Skip to main content
Glama

find_references

Locate every reference to a C/C++ symbol, including calls, reads, member accesses, indirect function-pointer registrations, and macro usages. Returns file, line, and reference kind for each occurrence in the indexed codebase.

Instructions

Find ALL references to a C/C++ symbol — calls, reads, member accesses, function pointer registrations, template references, and macro usages. libclang-powered: detects function-pointer registrations (interrupt vector table writes, callback attachments, ISR handler assignments) that text-based search cannot see.

Falls back to macro lookup when the symbol is not found as a function/method: returns the macro definition (kind="macro") and files that reference it (ref_kind="macro_use").

Read-only. No side effects. Returns every reference in the indexed codebase, including call sites, variable reads, struct member accesses, indirect function-pointer references, and macro usages. Requires the reference index (fw-context index — refs on by default).

For direct callers only use find_callers. For transitive callers use find_all_callers_recursive. For call paths between two symbols use find_call_path.

Args: name: Symbol name to find all references of. project_root: Project root directory. Auto-detected if omitted. limit: Maximum results (default 50, max 200).

Returns: list of dicts, each with: file, line, ref_kind, caller, caller_kind. ref_kind is one of: "call", "ref", "member", "indirect" (function-pointer reference in arguments, assignments, initializers, or init lists), "implicit_construct" (implicit constructor call from global/static object or member-field initialization), "macro_use" (macro usage in file). Macro fallback includes a leading dict with kind="macro", value, and expanded_value.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesSymbol name to find all references of — calls, reads, member accesses.
imageNoSysbuild image name within the variant (multi-project). Omit for all images of the variant.
limitNoMaximum results.
variantNoBuild variant name (multi-project). Omit to use default_variant or fail-closed. Use '*' for all variants.
project_rootNoProject root. Auto-detected if omitted.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden and meets it: it explicitly states 'Read-only. No side effects,' explains the macro fallback behavior, details the possible ref_kind values, and notes the requirement for the reference index. This gives the agent a complete picture of the tool's behavior and side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is long but well-structured: it front-loads the core purpose, then covers fallback, side effects, alternatives, args, and returns. The use of code spans and line breaks aids readability. Some redundancy exists (e.g., 'Returns every reference' repeats the first sentence), but overall every section earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is complex with multiple ref kinds, macro fallback, and an index prerequisite. The description covers all needed selection and invocation context: purpose, alternatives, prerequisites, side-effect profile, and return format. Even though an output schema exists, the description's Returns section is thorough. The missing image/variant parameters are fully documented in the schema, so completeness is maintained.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 100% description coverage, so the baseline is 3. The description's Args section mostly duplicates the schema, with one addition: the limit parameter's maximum of 200. It omits the image and variant parameters, but those are already well-documented in the schema. Therefore the description adds only marginal semantic value beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description begins with a specific verb and resource: 'Find ALL references to a C/C++ symbol' and enumerates the kinds of references (calls, reads, member accesses, function pointer registrations, macro usages). It clearly distinguishes itself from sibling tools by naming alternatives like find_callers, find_all_callers_recursive, and find_call_path, and explains the macro fallback behavior.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit when-to-use guidance: 'For direct callers only use find_callers. For transitive callers use find_all_callers_recursive. For call paths between two symbols use find_call_path.' It also states a prerequisite (requires the reference index) and describes the macro fallback scenario, giving clear context for when this tool is the right choice.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/turbyho/fw-context-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server