Skip to main content
Glama

find_callers

Find who calls a C/C++ function, including indirect calls via function pointers, callbacks, and ISR vector registrations.

Instructions

Find who calls a C/C++ function — direct calls AND indirect via function pointers, callbacks, interrupt vector registrations, and struct init lists. libclang-powered: detects function-pointer assignments and ISR vector registrations 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 use it (ref_kind="macro_use").

Use when you need a quick, flat list of immediate callers. For the full transitive call tree (who calls this indirectly through other functions), use find_all_callers_recursive. For all references including reads and member accesses, use find_references. For a path between two specific symbols, use find_call_path.

Read-only. No side effects. Requires the reference index (fw-context index — refs are on by default). Only direct call sites are returned; callers more than one hop away are not included.

Indirect edges (ref_kind: "indirect") are detected when a function pointer references a function through:

  • Call arguments: callback(&Class::method, this), EventQueue::call_every(ms, obj, &handler)

  • Assignments: driver.onData = &handleData, global_cb = &handler

  • Variable initializers: static void (*fp)(int) = &handler

  • Struct/array init lists: {.on_data = &handler}, {&fn_a, &fn_b}

Args: name: Symbol name to find callers of. Uses the same three-tier resolution as find_references (exact name, exact qualified, suffix LIKE). project_root: Project root directory. Auto-detected if omitted. limit: Maximum results (default 50).

Returns: list of dicts, each with: file, line, ref_kind ("call", "indirect", "implicit_construct", or "macro_use"), caller (enclosing function name), caller_kind ("function", "method", …). Macro fallback includes a leading dict with kind="macro", value, and expanded_value.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesSymbol name to find callers of. Returns direct call sites and indirect calls via function pointers.
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?

Despite no annotations, the description fully discloses behavior: read-only, no side effects, requires index, returns only direct callers, includes indirect edge detection patterns with examples, and falls back to macro lookup when the symbol is not found. This covers all key behavioral traits an agent needs to know.

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

Conciseness5/5

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

Though long, every section earns its place: clear purpose up front, explicit usage guidance, detailed behavior, indirect detection examples, and args summary. Uses headers and bullet lists for scannability. No repetition of schema content beyond what is helpful.

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?

Given the tool's complexity (C/C++ callgraph analysis, indirect edges, macro fallback) and rich output schema, the description covers all essential aspects: when to use, what to expect, prerequisites, limitations, and edge case behavior. The output schema handles return structure, so description needn't detail that further.

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

Parameters4/5

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

Schema coverage is 100%, so baseline is 3. The description adds meaningful context for 'name' (three-tier resolution), 'project_root' (auto-detected), and 'limit' (default 50). However, it omits 'image' and 'variant' entirely, though those are covered by schema descriptions. This adds some value beyond schema without fully compensating for the omitted parameters.

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 explicitly states 'Find who calls a C/C++ function — direct calls AND indirect via function pointers' with specific detail on what it detects, distinguishing it from sibling tools like find_all_callers_recursive and find_references by contrasting scope. The verb+resource pair is precise and immediately clear.

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?

Provides explicit guidance: 'Use when you need a quick, flat list of immediate callers' and names alternatives for different needs (find_all_callers_recursive, find_references, find_call_path). Also mentions prerequisites like requiring the reference index and that only direct call sites are returned, helping the agent decide when to use this tool.

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