Skip to content

code_trace

code_trace follows the call graph from a starting symbol, either downward (what it calls) or upward (what calls it). Use it to understand how a function fits into the larger system.

code_trace(name="OrderService.checkout", direction="down")
ParameterTypeDefaultDescription
namestringrequiredStarting symbol
direction"up" | "down""down"Follow callees or callers
depthnumber5Max hops to follow
OrderService.checkout (src/services/order.ts:42)
└─ PaymentService.charge (src/services/payment.ts:18)
└─ stripe.charges.create (external)
└─ InventoryService.reserve (src/services/inventory.ts:91)
└─ db.query (src/db/client.ts:7)
└─ orders_table (postgres)
└─ NotificationService.send (src/services/notify.ts:33)

For HTTP routes, use code_route_trace which combines route lookup with full call tracing:

code_route_trace(route="/api/orders", method="POST")
→ Router → OrderController.create → OrderService.checkout → ...