Build a Call Graph
call_graphTrace C# call graphs from a method name to follow callees or callers, limit depth, and return caller-callee edges with constructor and interface-contract links.
Instructions
Build a depth-limited call graph rooted at a method NAME. direction='callees' follows project-internal calls outward; direction='callers' follows the inverse (who calls this). Returns (caller, callee) edges using method-lookup keys, cycle-safe and capped at 500 edges (truncated flag). A creation (new X(...)) is an edge to the constructor it binds, keyed 'Ns.X.X(params)', and both directions walk on through a constructor: into what it calls and creates, out to the code that creates the object. A local function's key ends in '@::', character offsets rather than a line ('localFunctionKeyNote' repeats this when the answer holds one). A bare name is rooted at the name, NOT at one symbol: EVERY same-named declaration in the solution is a root and the graph is their union, so a common name (e.g. 'ExecuteAsync') can pull in unrelated members and inflate the payload. The qualified 'Type.Method' form roots only that type's declarations of the name, overloads included. With direction='callers' every node also brings in the callers of the interface and abstract members it implements, at every hop as impact_of_change does (a call through the contract is recorded there); 'viaContract' names those members with their implementation counts (one implementation: exact, several: a union) and the nodes that brought them in ('creditedBy'). 'rootedAt' lists the declarations actually walked - check it when the result looks too big (then re-query a rarer or qualified name) and when it is empty (the name resolved to nothing, which an empty edge list alone does not tell you).
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": {
"sessionId": "<sessionId>",
"method": "<method>"
},
"name": "call_graph"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| depth | No | Max traversal depth (1-10). Default 2. | |
| method | Yes | The root method's name, bare or as 'Type.Method'. | |
| direction | No | 'callees' (default) or 'callers'. | callees |
| sessionId | Yes | The session_id returned by analyze_solution. Also takes an absolute .sln/.slnx/.slnf path, analyzed on first use. |