Skip to main content
Glama

find_callers

Find who calls a C/C++ function, including indirect calls via function pointers, callbacks, and struct initialization lists.

Instructions

USE INSTEAD OF grep, ctx_callgraph, or ctx_compose. Find who calls a C/C++ function — direct calls AND indirect via function pointers, callbacks, NVIC_SetVector, and struct init lists. grep cannot detect function pointer assignments or ISR vector registrations.

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.

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" or "indirect"), caller (enclosing function name), caller_kind ("function", "method", …).

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?

With no annotations, the description fully discloses behavior: requires reference index, returns only direct call sites, and details how indirect edges are detected with examples (call arguments, assignments, initializers, struct/array init lists). Also explains limitations (no transitive calls).

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 well-structured with bullet points and examples, but is relatively long. Information is front-loaded with key usage guidance, but some redundancy could be trimmed. Still clear and organized.

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 complexity of indirect call detection, the description is comprehensive: it explains the tool's purpose, usage guidelines, behavioral traits, parameter details, and return format. It covers all necessary context for an AI agent to use the tool correctly.

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%, but the description adds significant context: three-tier resolution for name, auto-detection of project_root, default limit, and describes return format with fields. Exceeds baseline of 3 by providing extra semantic detail 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 the tool finds callers of a C/C++ function, including direct and indirect calls. It distinguishes from siblings like grep, ctx_callgraph, and find_all_callers_recursive, making the purpose specific and unambiguous.

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?

Explicitly states when to use this tool (for a quick flat list of immediate callers) and when to use alternatives (find_all_callers_recursive for transitive tree, find_references for all references, find_call_path for path between symbols). Provides clear exclusions and guidance.

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