find_callers
Finds every caller of a method or function, showing file, method, line range, and call-site line; use depth 2–5 for impact analysis and regex patterns for broad or exact matches.
Instructions
Who calls it: file, method, line range and the call's own line (L25 │ code) of each caller; paths are relative to the root: line. Start with the name pattern (regex) (^|::|\.|->)cancel$: it finds every call, also with an unknown/inherited receiver. Order::cancel lists only calls resolved to that type (via <Type> = through its interface/parent/trait), so it can miss callers; ?::name = name-only match. depth 2–5 = impact analysis (callers of callers); guess adds name-only matches (?). Example: {"pattern": "(^|::|\.|->)cancel$", "path": "app"}.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"pattern": "<pattern>"
},
"name": "find_callers"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| full | No | Disable the 400-line output cap. | |
| path | No | Search scope (file or directory) relative to the project root; default: the whole root. | |
| depth | No | 1 (default) = direct callers; 2–5 = callers of callers (impact analysis). | |
| guess | No | Also follow name-only matches (marked `?`). | |
| layer | No | Search only files of this layer (level 1), e.g. `controller`. | |
| pattern | Yes | What is called (regex on the callee): start with `(^|::|\.|->)cancel$` (every call of the name); `Order::cancel` = only calls resolved to that type; JS keys: `useForm.js::submit`, `route::orders.show`. | |
| project | No | Registered project alias; default: the server's working directory. | |
| by_layer | No | Group callers by layer (closest to the callee first), each group under a `[service] 3 callers` header. |