Skip to main content
Recipes

Recipe: Find all callers of a function

Problem: You want to change the signature of UserService.findById. Before touching it, you need to know every call site.

Using Claude Desktop

In a conversation with Claude (with Travsr connected as MCP):

"Find all callers of UserService.findById in my repo."

Claude calls get_callers and returns:

Callers of UserService.findById (5 found):

src/controllers/UserController.ts:88 UserController.getProfile()
src/controllers/AdminController.ts:142 AdminController.impersonate()
src/resolvers/UserResolver.ts:34 UserResolver.user()
src/jobs/CleanupJob.ts:67 CleanupJob.expireInactiveUsers()
src/tests/user.test.ts:28 describe('UserService')

Using the CLI

travsr ask "UserService.findById"

travsr ask looks up both callers and dependencies for a symbol (partial match supported). For callers only, walk incoming edges with travsr graph:

travsr graph "UserService.findById" --direction callers

Add --format json for machine-readable output, or --format dot to render with Graphviz.

What to do with the results

For each caller, check:

  1. Does it pass all the arguments your new signature requires?
  2. Does it handle the new return type correctly?
  3. Are there tests for this caller that need updating?

The callers list gives you a definitive checklist: no grepping, no guessing.