MCPInstall

grepai-trace-callers

Find function callers with GrepAI trace. Use this skill to discover what code calls a specific function.

Installs
787
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/yoanbernabeu/grepai-skills --skill grepai-trace-callers
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads grepai-trace-callers automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

GrepAI Trace Callers

This skill covers using grepai trace callers to find all code locations that call a specific function or method.

When to Use This Skill

  • Finding all usages of a function before refactoring
  • Understanding function dependencies
  • Impact analysis before changes
  • Code navigation and exploration

What is Trace Callers?

grepai trace callers answers: "Who calls this function?"

func Login(user, pass) {...}
        ↑
        │
┌───────┴───────────────────┐
│   Who calls Login()?      │
├───────────────────────────┤
│ • HandleAuth (auth.go:42) │
│ • TestLogin (test.go:15)  │
│ • CLI (main.go:88)        │
└───────────────────────────┘

Basic Usage

grepai trace callers "FunctionName"

Example

grepai trace callers "Login"

Output:

🔍 Callers of "Login"

Found 3 callers:

1. HandleAuth
   File: handlers/auth.go:42
   Context: user.Login(ctx, credentials)

2. TestLoginSuccess
   File: handlers/auth_test.go:15
   Context: result := Login(testUser, testPass)

3. RunCLI
   File: cmd/main.go:88
   Context: err := auth.Login(username, password)

JSON Output

For programmatic use:

grepai trace callers "Login" --json

Output:

{
  "query": "Login",
  "mode": "callers",
  "count": 3,
  "results": [
    {
      "file": "handlers/auth.go",
      "line": 42,
      "caller": "HandleAuth",
      "context": "user.Login(ctx, credentials)"
    },
    {
      "file": "handlers/auth_test.go",
      "line": 15,
      "caller": "TestLoginSuccess",
      "context": "result := Login(testUser, testPass)"
    },
    {
      "file": "cmd/main.go",
      "line": 88,
      "caller": "RunCLI",
      "context": "err := auth.Login(username, password)"
    }
  ]
}

Compact JSON (AI Optimized)

grepai trace callers "Login" --json --compact

Output:

{
  "q": "Login",
  "m": "callers",
  "c": 3,
  "r": [
    {"f": "handlers/auth.go", "l": 42, "fn": "HandleAuth"},
    {"f": "handlers/auth_test.go", "l": 15, "fn": "TestLoginSuccess"},
    {"f": "cmd/main.go", "l": 88, "fn": "RunCLI"}
  ]
}

TOON Output (v0.26.0+)

TOON format offers ~50% fewer tokens than JSON:

grepai trace callers "Login" --toon

Output:

callers[3]:
  - call_site:
      context: "user.Login(ctx, credentials)"
      file: handlers/auth.go
      line: 42
    symbol:
      name: HandleAuth
      ...

Note: --json and --toon are mutually exclusive.

Extraction Modes

GrepAI offers two extraction modes:

Fast Mode (Default)

Uses regex patterns. Fast and dependency-free.

grepai trace callers "Login" --mode fast

Precise Mode

Uses tree-sitter AST parsing. More accurate but requires tree-sitter.

grepai trace callers "Login" --mode precise

Comparison

ModeSpeedAccuracyDependencies
fast⚡⚡⚡GoodNone
precise⚡⚡Excellenttree-sitter

Configuration

Configure trace in .grepai/config.yaml:

trace:
  mode: fast  # fast or precise

  enabled_languages:
    - .go
    - .js
    - .ts
    - .py
    - .php
    - .rs

  exclude_patterns:
    - "*_test.go"
    - "*.spec.ts"

Supported Languages

LanguageExtensions
Go.go
JavaScript.js, .jsx
TypeScript.ts, .tsx
Python.py
PHP.php
C/C++.c, .h, .cpp, .hpp, .cc, .cxx
Rust.rs
Zig.zig
C#.cs
Java.java
Pascal/Delphi.pas, .dpr

Use Cases

Before Refactoring

# Find all usages before renaming
grepai trace callers "getUserById"

# Check impact of changing signature
grepai trace callers "processPayment"

Understanding Codebase

# Who uses this core function?
grepai trace callers "validateToken"

# Find entry points to a module
grepai trace callers "initialize"

Debugging

# Where is this function called from?
grepai trace callers "problematicFunction"

Code Review

# Verify function usage before approving changes
grepai trace callers "deprecatedMethod"

Handling Common Names

If your function name is common, results may include unrelated code:

Problem

grepai trace callers "get"  # Too common, many false positives

Solutions

  1. Use more specific name:
grepai trace callers "getUserProfile"
  1. Filter results by path:
grepai trace callers "get" --json | jq '.results[] | select(.file | contains("auth"))'

Combining with Semantic Search

Use together for comprehensive understanding:

# Find what Login does (semantic)
grepai search "user login authentication"

# Find who uses Login (trace)
grepai trace callers "Login"

Scripting Examples

Bash

# Count callers
grepai trace callers "MyFunction" --json | jq '.count'

# Get caller function names
grepai trace callers "MyFunction" --json | jq -r '.results[].caller'

# Get file paths only
grepai trace callers "MyFunction" --json | jq -r '.results[].file' | sort -u

Python

import subprocess
import json

result = subprocess.run(
    ['grepai', 'trace', 'callers', 'Login', '--json'],
    capture_output=True,
    text=True
)

data = json.loads(result.stdout)
print(f"Found {data['count']} callers of Login:")
for r in data['results']:
    print(f"  - {r['caller']} in {r['file']}:{r['line']}")

Common Issues

❌ Problem: No callers found ✅ Solutions:

  • Check function name spelling (case-sensitive)
  • Ensure file type is in enabled_languages
  • Run grepai watch to update symbol index

❌ Problem: Too many false positives ✅ Solutions:

  • Use more specific function name
  • Add exclude patterns in config
  • Filter results with jq

❌ Problem: Missing some callers ✅ Solutions:

  • Try --mode precise for better accuracy
  • Check if files are in ignore patterns

Best Practices

  1. Use exact function name: Case matters
  2. Check symbol index: Run grepai watch first
  3. Use JSON for scripts: Easier to parse
  4. Combine with search: Semantic + trace = full picture
  5. Filter large results: Use jq or grep

Output Format

Trace callers result:

🔍 Callers of "Login"

Mode: fast
Language files scanned: 245

Found 3 callers:

1. HandleAuth
   File: handlers/auth.go:42
   Context: user.Login(ctx, credentials)

2. TestLoginSuccess
   File: handlers/auth_test.go:15
   Context: result := Login(testUser, testPass)

3. RunCLI
   File: cmd/main.go:88
   Context: err := auth.Login(username, password)

Tip: Use --json for machine-readable output
     Use --mode precise for more accurate results

FAQ

What does the grepai-trace-callers skill do?

Find function callers with GrepAI trace. Use this skill to discover what code calls a specific function.

How do I install grepai-trace-callers?

Run npx skills add https://github.com/yoanbernabeu/grepai-skills --skill grepai-trace-callers in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/grepai-trace-callers/ (personal) or .claude/skills/grepai-trace-callers/ (project).

Which AI agents can use grepai-trace-callers?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is grepai-trace-callers safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains grepai-trace-callers?

It is published by yoanbernabeu in yoanbernabeu/grepai-skills. It has 787 recorded installs.

More from yoanbernabeu/grepai-skills

View all →

grepai-search-basics

yoanbernabeu/grepai-skills

Basic semantic code search with GrepAI. Use this skill to learn fundamental search commands and concepts.

grepai-search-advanced

yoanbernabeu/grepai-skills

Advanced search options in GrepAI. Use this skill for JSON output, compact mode, and AI agent integration.

AI & Agents828 installs

grepai-trace-graph

yoanbernabeu/grepai-skills

Build complete call graphs with GrepAI trace. Use this skill for recursive dependency analysis.

805 installs

grepai-ollama-setup

yoanbernabeu/grepai-skills

Install and configure Ollama for local embeddings with GrepAI. Use this skill when setting up private, local embedding generation.

AI & Agents799 installs

grepai-search-tips

yoanbernabeu/grepai-skills

Tips and best practices for effective GrepAI searches. Use this skill to improve search result quality.

grepai-trace-callees

yoanbernabeu/grepai-skills

Find function callees with GrepAI trace. Use this skill to discover what functions a specific function calls.

765 installs

Popular other skills

View category →

hyperframes-cli

heygen-com/hyperframes

The HyperFrames CLI by job - scaffold, check, look at frames, edit the timeline, preview, render locally or in the cloud, publish, project history - plus reading its JSON and recovering from build or render failures.

1.3M installs

triage

mattpocock/skills

Move issues and external PRs through a state machine of triage roles, categorise, verify, grill if needed, and write agent-ready briefs.

1M installs

ask-matt

mattpocock/skills

Ask which skill or flow fits your situation. A router over the skills in this repo.

778.4K installs

to-questionnaire

mattpocock/skills

Turn a decision you can't fully answer into a questionnaire for someone else to fill in.

508.9K installs

wait-what

mattpocock/skills

Stop. That last message did not land: re-pitch it.

459.7K installs

loop-me

mattpocock/skills

Grill me about specs for the workflows I want to build, within this workspace.

447.9K installs