Build call graph / function tree (IDA call graph)
build-call-graphMaps a Luau function's nested protos into an IDA-style call graph, returning flattened parent/depth nodes to trace callees, spot deeply nested logic, and pick disassembly targets.
Instructions
Build an IDA-style call graph (function tree) rooted at a target Luau function. Each Luau function carries its nested protos — the functions it can construct and call — so this recurses through getprotos breadth-first to map the callee tree. Returns a FLATTENED node list (each node knows its parentIndex and depth) so you can reconstruct the tree, plus per-node proto/upvalue counts and source/line from debug.info. Use it to understand how a closure fans out into helpers, spot deeply nested logic, and pick disassembly targets. Resolve the root via a Luau expression (e.g. "getrenv().game.PlayerScripts.Main.someFunc" or a global). Requires getprotos; caps depth and node count. Signature: { functionPath: string, maxDepth: any?, maxNodes: any?, threadContext: number? }. Phase: observe; cost=medium; idempotency=read-only. Requires: active-client, resolved-target. Produces: operation-receipt. Safety: read-only. On failure: inspect tool-schema for exact fields, defaults, constraints, and an invocation example.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| maxDepth | No | How many proto levels deep to recurse from the root (default 3, max 6). Root is depth 0. | |
| maxNodes | No | Hard cap on total nodes (including the root) to keep the graph bounded (default 120). | |
| functionPath | Yes | Luau expression that resolves to the ROOT function (e.g. "getgenv().myFunc" or "require(game.ReplicatedStorage.Mod).start"). Evaluated as `return <expr>`; must yield a function. | |
| threadContext | No | Optional Roblox thread identity for this call; omit it to use the server default. |