# Inspector.tree

Builds the call tree a trace describes.

The engine records a flat sequence; nesting is recovered here from the order of the call and return events. A truncated trace yields the frames it captured, with the unfinished ones missing their output and gas.

## Imports

:::code-group
```ts [Named]
import { Inspector } from 'ox/evm'
```

```ts [Entrypoint]
import * as Inspector from 'ox/evm/Inspector'
```
:::

## Examples

```ts twoslash
// @noErrors
import { Evm, Inspector } from 'ox/evm'

Evm.setInspector(evm, {})
const result = Evm.callTx(evm, transaction)

const [root] = Inspector.tree(result.trace)
root.calls.length
```

## Definition

```ts
function tree(
  trace: Inspector.Trace,
): readonly Frame[]
```

**Source:** [src/evm/Inspector.ts](https://github.com/wevm/ox/blob/main/src/evm/Inspector.ts#L118)

## Parameters

### trace

* **Type:** [`Inspector.Trace`](/evm/execution/Inspector/types#inspectortrace)

Recorded execution.

## Return Type

The frames the trace describes, outermost first.

`readonly Frame[]`
