Skip to main content
Glama
bsdnn
by bsdnn

findCallers

Find all functions that call a given function to trace reverse call graph and understand code dependencies.

Instructions

Find all functions that call a given function (reverse call graph)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
functionNameYesName of the function to find callers for

Implementation Reference

  • The handleFindCallers method: the main handler that executes the findCallers tool logic. It looks up the symbol by name, then queries the call graph for callers, and formats the result.
    private async handleFindCallers(functionName: string): Promise<{ content: TextContent[] }> {
      if (!this.codeAnalyzer || !this.callGraphAnalyzer) {
        return {
          content: [
            {
              type: 'text',
              text: 'Analyzer not initialized',
            },
          ],
        };
      }
    
      const config = this.configManager.getConfig();
      const vscodeLinkGen = new VSCodeLinkGenerator(config);
    
      const symbols = this.codeAnalyzer.findSymbolByName(functionName);
    
      if (symbols.length === 0) {
        return {
          content: [
            {
              type: 'text',
              text: `No symbol found with name: ${functionName}`,
            },
          ],
        };
      }
    
      const symbol = symbols[0];
      const callers = this.callGraphAnalyzer.findCallers(symbol.id);
    
      let result = `# Callers of ${functionName}\n\n`;
      result += `Found ${callers.length} callers:\n\n`;
    
      for (const caller of callers) {
        const vscodeLink = vscodeLinkGen.generate(caller);
        result += `- **${caller.name}** (${caller.type})\n`;
        result += `  Location: ${caller.location.file}:${caller.location.range.start.line}\n`;
        if (vscodeLink) {
          result += `  [Open in VSCode](${vscodeLink})\n`;
        }
        result += '\n';
      }
    
      return {
        content: [
          {
            type: 'text',
            text: result,
          },
        ],
      };
    }
  • Tool registration with input schema defining the 'functionName' parameter for findCallers.
    {
      name: 'findCallers',
      description: 'Find all functions that call a given function (reverse call graph)',
      inputSchema: {
        type: 'object' as const,
        properties: {
          functionName: {
            type: 'string',
            description: 'Name of the function to find callers for',
          },
        },
        required: ['functionName'],
      },
  • src/index.ts:169-170 (registration)
    Routing in the tool dispatch switch statement: maps 'findCallers' tool name to handleFindCallers.
    case 'findCallers':
      return this.handleFindCallers(args.functionName);
  • The core graph algorithm: findCallers method on CallGraphAnalyzer. Uses graphology inNeighbors to find all symbols that call the given symbol.
    findCallers(symbolId: string): Symbol[] {
      const callers: Symbol[] = [];
      const inNeighbors = this.graph.inNeighbors(symbolId);
    
      inNeighbors.forEach((callerId: string) => {
        const node = this.graph.getNodeAttributes(callerId);
        if (node.symbol) {
          callers.push(node.symbol);
        }
      });
    
      return callers;
    }
  • Helper usage of findCallers within handleWhoTriggers to filter out symbols with no upstream callers (top-level entries).
    const realEntries = upstream.filter(
      (s) => this.callGraphAnalyzer!.findCallers(s.id).length === 0
    );
Behavior3/5

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

With no annotations, the description should disclose behavioral traits. It mentions 'reverse call graph' but does not explain whether results are transitive, shallow, or include call context (e.g., line numbers). There is no mention of performance or limits.

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?

The description is a single, clear sentence that efficiently conveys the tool's purpose without any unnecessary words or repetition.

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

Completeness4/5

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

Given the simplicity of the tool (one parameter, no output schema), the description covers the essential purpose. However, it could be more complete by mentioning the return value format (e.g., list of function names) or any limitations (e.g., does not cross module boundaries).

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 input schema already provides a clear description for the single parameter 'functionName'. The description adds no additional semantic value beyond restating the parameter's purpose, so it meets the baseline for 100% schema coverage.

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 identifies the action ('Find') and the resource ('functions that call a given function'), and uses the phrase 'reverse call graph' which distinguishes it from sibling tools like 'traceBusinessFlow' or 'getCriticalPoints'.

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

Usage Guidelines3/5

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

The description implies the tool is used when one needs to find callers of a function, but it lacks explicit guidance on when to prefer this over alternatives like searchSymbols or traceBusinessFlow, nor does it mention any preconditions or caveats.

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/bsdnn/mcp-code-flow-analyzer'

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