# `Raxol.MCP.StructuredScreenshot`
[🔗](https://github.com/DROOdotFOO/raxol/blob/v2.7.0/lib/raxol/mcp/structured_screenshot.ex#L1)

Converts a view tree into a clean, JSON-friendly widget summary.

Used by the `raxol_screenshot` MCP tool to return structured content
alongside the plain text capture. Strips callbacks and normalizes
widget nodes to a consistent shape.

# `widget_summary`

```elixir
@type widget_summary() :: %{
  :type =&gt; atom(),
  :id =&gt; String.t() | nil,
  :children =&gt; [widget_summary()],
  optional(:content) =&gt; String.t(),
  optional(:animation_hints) =&gt; [map()],
  optional(:role) =&gt; atom(),
  optional(:label) =&gt; String.t(),
  optional(:state) =&gt; %{optional(atom()) =&gt; boolean() | atom()},
  optional(:value) =&gt; term(),
  optional(:focused) =&gt; boolean(),
  optional(:live) =&gt; boolean()
}
```

# `from_view_tree`

```elixir
@spec from_view_tree(
  map() | list() | nil,
  keyword()
) :: [widget_summary()]
```

Convert a view tree map to a list of widget summaries.

Each node retains `:type`, `:id`, `:content` (if text), and recursed
`:children`. All callbacks and style details are stripped. Accessibility
fields (`:role`, `:label`, `:state`, `:value`, `:focused`, `:live`) are folded
in per node via `Raxol.Core.Accessibility.Projection` so agents get a
machine-readable role/state alongside the structural tree.

## Options

  * `:focused_id` - Element id currently focused; marks that node `focused: true`
    in addition to any Component-reported focus.
  * `:type_map` - override the projection's declaration-type -> Component map.

# `to_json`

```elixir
@spec to_json([widget_summary()]) :: String.t()
```

Encode a widget summary list to a JSON string.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
