mit einem Klick
grepai-trace-callees
// Find function callees with GrepAI trace. Use this skill to discover what functions a specific function calls.
// Find function callees with GrepAI trace. Use this skill to discover what functions a specific function calls.
Reference for all GrepAI MCP tools. Use this skill to understand available MCP tools and their parameters.
Advanced search options in GrepAI. Use this skill for JSON output, compact mode, and AI agent integration.
Find function callers with GrepAI trace. Use this skill to discover what code calls a specific function.
Build complete call graphs with GrepAI trace. Use this skill for recursive dependency analysis.
Supported programming languages in GrepAI. Use this skill to understand which languages can be indexed and traced.
Troubleshooting guide for GrepAI. Use this skill to diagnose and fix common issues.
| name | grepai-trace-callees |
| description | Find function callees with GrepAI trace. Use this skill to discover what functions a specific function calls. |
This skill covers using grepai trace callees to find all functions called by a specific function.
grepai trace callees answers: "What does this function call?"
func ProcessOrder(order) {
validateOrder(order)
calculateTotal(order)
sendConfirmation(order.email)
}
│
↓
┌───────┴───────────────────┐
│ What does ProcessOrder │
│ call? │
├───────────────────────────┤
│ • validateOrder │
│ • calculateTotal │
│ • sendConfirmation │
└───────────────────────────┘
grepai trace callees "FunctionName"
grepai trace callees "ProcessOrder"
Output:
🔍 Callees of "ProcessOrder"
Found 4 callees:
1. validateOrder
File: services/order.go:45
Context: validateOrder(order)
2. calculateTotal
File: services/order.go:48
Context: total := calculateTotal(order.Items)
3. applyDiscount
File: services/order.go:51
Context: total = applyDiscount(total, order.Coupon)
4. sendConfirmation
File: services/order.go:55
Context: sendConfirmation(order.Email, total)
grepai trace callees "ProcessOrder" --json
Output:
{
"query": "ProcessOrder",
"mode": "callees",
"count": 4,
"results": [
{
"file": "services/order.go",
"line": 45,
"callee": "validateOrder",
"context": "validateOrder(order)"
},
{
"file": "services/order.go",
"line": 48,
"callee": "calculateTotal",
"context": "total := calculateTotal(order.Items)"
},
{
"file": "services/order.go",
"line": 51,
"callee": "applyDiscount",
"context": "total = applyDiscount(total, order.Coupon)"
},
{
"file": "services/order.go",
"line": 55,
"callee": "sendConfirmation",
"context": "sendConfirmation(order.Email, total)"
}
]
}
grepai trace callees "ProcessOrder" --json --compact
Output:
{
"q": "ProcessOrder",
"m": "callees",
"c": 4,
"r": [
{"f": "services/order.go", "l": 45, "fn": "validateOrder"},
{"f": "services/order.go", "l": 48, "fn": "calculateTotal"},
{"f": "services/order.go", "l": 51, "fn": "applyDiscount"},
{"f": "services/order.go", "l": 55, "fn": "sendConfirmation"}
]
}
TOON format offers ~50% fewer tokens than JSON:
grepai trace callees "ProcessOrder" --toon
Note:
--jsonand--toonare mutually exclusive.
grepai trace callees "ProcessOrder" --mode fast
grepai trace callees "ProcessOrder" --mode precise
| Mode | Speed | Accuracy | Dependencies |
|---|---|---|---|
fast | ⚡⚡⚡ | Good | None |
precise | ⚡⚡ | Excellent | tree-sitter |
# What does this complex function do?
grepai trace callees "handleRequest"
# Map the data flow
grepai trace callees "processPayment"
# What external services does this call?
grepai trace callees "syncData"
# What database operations happen?
grepai trace callees "saveUser"
# What side effects does this function have?
grepai trace callees "updateProfile"
# Is this function doing too much?
grepai trace callees "doEverything" # Lots of callees = code smell
# Generate dependency list for docs
grepai trace callees "initialize" --json | jq '.results[].callee'
| Command | Question | Use Case |
|---|---|---|
trace callers | Who calls me? | Impact analysis |
trace callees | What do I call? | Behavior analysis |
# Combined analysis
grepai trace callers "processOrder" # Who uses this?
grepai trace callees "processOrder" # What does it do?
# Get callees and filter to only .go files
grepai trace callees "main" --json | jq '.results[] | select(.file | endswith(".go"))'
grepai trace callees "Login" --json | jq '.results[] | select(.callee | startswith("Test") | not)'
# Count how many database vs. API calls
grepai trace callees "processOrder" --json | jq '.results[].callee' | grep -c "db"
The trace finds:
func ProcessOrder(order Order) error {
// Direct call
validateOrder(order)
// Method call
order.Validate()
// Package function
utils.Log("processing")
// Built-in (may or may not be captured)
fmt.Println("done")
return nil
}
Callees found:
validateOrderValidate (method)Log (from utils)Println (depending on mode)func process(fn func()) {
fn() // Callee is unknown at static analysis time
}
For recursive dependency analysis, use trace graph:
# Direct callees only
grepai trace callees "main"
# Full dependency tree (recursive)
grepai trace graph "main" --depth 3
grepai trace callees "main" --json | jq -r '.results[].callee' | sort -u
# Does processOrder call sendEmail?
grepai trace callees "processOrder" --json | jq -e '.results[] | select(.callee == "sendEmail")' && echo "Yes" || echo "No"
#!/bin/bash
echo "# Function Dependencies Report"
echo ""
for fn in main initialize processOrder; do
echo "## $fn"
grepai trace callees "$fn" --json | jq -r '.results[].callee' | sed 's/^/- /'
echo ""
done
❌ Problem: Function not found ✅ Solution: Check spelling and ensure function exists in indexed files
❌ Problem: No callees found (but function has calls) ✅ Solutions:
--mode preciseenabled_languagesgrepai watch)❌ Problem: Missing some callees
✅ Solution: Use --mode precise for better accuracy
Trace callees result:
🔍 Callees of "ProcessOrder"
Mode: fast
Function found in: services/order.go:40
Found 4 callees:
1. validateOrder
File: services/order.go:45
Context: validateOrder(order)
2. calculateTotal
File: services/order.go:48
Context: total := calculateTotal(order.Items)
3. applyDiscount
File: services/order.go:51
Context: total = applyDiscount(total, order.Coupon)
4. sendConfirmation
File: services/order.go:55
Context: sendConfirmation(order.Email, total)
Tip: Use 'grepai trace graph ProcessOrder' for recursive analysis