magento_trace_call_chain
Trace code execution paths in Magento 2 by specifying a starting class and method. Resolves same-class calls, dependency injection, and event dispatch to build a call tree.
Instructions
Trace the internal method call chain starting from a specific class::method. Follows $this->method() calls (same class), $this->dependency->method() calls (resolves DI types), and eventManager->dispatch() calls (maps to observers from events.xml). Returns a call tree showing the execution path through the code.
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": {
"className": "<className>",
"methodName": "<methodName>"
},
"name": "magento_trace_call_chain"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| maxDepth | No | Maximum recursion depth for tracing (default: 3). Higher values trace deeper but take longer. | |
| className | Yes | Full PHP class name (FQCN) to start tracing from. Examples: "Vendor\OrderSplit\Model\CreateOrder\CreateChildOrder", "Magento\Quote\Model\QuoteManagement" | |
| methodName | Yes | Method name to start tracing. Examples: "execute", "submit", "collectTotals" |