Skip to main content
Glama

find_callers

Find direct and indirect callers of any C/C++ function, including calls through function pointers, callbacks, and interrupt vectors. Falls back to macro lookup for symbols not found as functions.

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.
limitNoMaximum results.
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?

Description transparently states 'Read-only. No side effects. Requires the reference index' and explains that only direct call sites are returned. It elaborates on indirect edge detection with examples. Without annotations, this fully compensates for behavioral disclosure.

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 lengthy but well-structured with bullet points, sections, and front-loaded main purpose. Each sentence is informative, though minor redundancy could be trimmed. Still, it's organized and clear.

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 and presence of an output schema, the description thoroughly covers purpose, usage, indirect detection, macro fallback, parameter details, and return format. No gaps remain for an agent to correctly select and invoke the tool.

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%, providing baseline 3, but the description adds context like 'Uses same three-tier resolution as find_references' for the name parameter and explains the return format in Args. This adds meaningful 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 clearly states 'Find who calls a C/C++ function' and specifies it finds direct calls and indirect via function pointers, callbacks, etc. It distinguishes from sibling tools like find_all_callers_recursive and find_references by explicitly stating the scope and use cases.

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?

Explicit guidance is provided: 'Use when you need a quick, flat list of immediate callers. For the full transitive call tree, use find_all_callers_recursive. For all references... use find_references.' Also describes when macro fallback occurs. This clearly tells when to use vs alternatives.

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