# parse_js_eval_blocks

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/tui/widgets/_js_eval_display/parse_js_eval_blocks)

Parse `js_eval` output into structured display blocks.

Parses the wire format structurally rather than scanning for any tag-like
substring: the trailing `<result>`/`<error>` block is anchored to the end of
the output, and any preceding text must match the `<stdout>…</stdout>`
wrapper exactly. The stdout body is taken verbatim and never re-scanned, so
tag-like text printed by user code is preserved as stdout rather than
mis-parsed into fake result/error sections.

## Signature

```python
parse_js_eval_blocks(
    output: str,
) -> list[JsEvalBlock] | None
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `output` | `str` | Yes | Raw tool output from the `js_eval` tool. |

## Returns

`list[JsEvalBlock] | None`

Parsed blocks, with stdout first when present, or `None` if the output

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/e14e0adcbe78565ed3650e7f24b2a775d5437d25/libs/code/deepagents_code/tui/widgets/_js_eval_display.py#L95)