Code to UI

Code to UI lets your coding agent see what any source location looks like in the running browser. The agent queries by file path and line number and gets back live runtime context -- no human interaction needed.

Code to UI — agent queries Domscribe to see what renders at a source location

How It Works

  1. Your agent calls domscribe.query.bySource with a source file path and line number.
  2. The MCP server looks up the data-ds element ID from the manifest (.domscribe/manifest.jsonl), which maps source locations to DOM elements.
  3. The relay broadcasts a context request to the browser over WebSocket.
  4. The Domscribe runtime in the browser finds the matching DOM element, walks the React fiber tree or Vue VNode tree, and captures the live context.
  5. The response is sent back to the agent with:
    • DOM snapshot -- the rendered HTML of the element and its children
    • Current props -- the component's current prop values
    • Component state -- the component's current state (React useState/useReducer, Vue reactive state)
    • Rendered attributes -- CSS classes, inline styles, data-* attributes, and other DOM attributes

Prerequisites

Prompting Your Agent

Agents do not spontaneously query runtime state. You need to prompt them explicitly. For example:

The more specific you are about wanting the agent to check the live UI, the more likely it is to call domscribe.query.bySource before making changes.

MCP Tool Reference

domscribe.query.bySource

ParameterTypeDescription
filePathstringAbsolute or project-relative path to the source file
linenumberLine number in the source file

The tool returns the live DOM snapshot, props, state, and rendered attributes for the element at that source location. If no matching element is found in the browser, the tool returns the manifest entry without runtime context.

Related