HTTP discovery, WebSocket commands
After the app starts DevTools, the server binds to loopback by default. /json and /json/list return targets; /json/version returns version metadata. A target’s webSocketDebuggerUrl points to its WebSocket. Each instance has its own authentication token. Keep that URL inside trusted debugging processes and do not start the server unconditionally in a distributed app.
The request and response shape
A command has an integer id, a method and params. Success returns result with the same id. The default protocol places failures in a top-level error with code and message. This example shows only the request; it does not print an authenticated URL.
{"id":7,"method":"DOM.querySelector","params":{"selector":"#save"}}Default v3.2 and older clients
The default v3.2 envelope puts an unknown-method error at the top level, for example code -32601. Older clients can add proto=v3.1 to the WebSocket URL to keep errors inside result. This is KUI’s response-envelope version, not Chromium’s CDP version or the engine/SDK version.
{"id":7,"error":{"code":-32601,"message":"Unknown method: Unknown.method"}}Find methods by task
This table lists representative methods rather than a fixed total. Check the bundled documentation and the current server route table for the exact set. Some methods belong to KUI-specific domains.
| Task | Method examples | What it provides |
|---|---|---|
| DOM and listeners | DOM.getDocument · DOM.querySelector · DOM.getEventListeners · DOM.setTextContent | Find nodes, listeners and edit text at runtime |
| Inspect or edit CSS | CSS.getComputedStyle · CSS.getMatchedRules · CSS.setProperty | Computed values, matched rules and live edits |
| Inspect the page | Page.getInfo · Page.screenshot · Page.getLayoutMetrics | Target info, screenshot and viewport geometry |
| Operate the UI | Input.dispatchMouseEvent · Input.dispatchKeyEvent | Mouse, keyboard and real interactions |
| Debug Lua | Debugger.setBreakpoint · Debugger.getScope · Runtime.evaluate | Breakpoints, variables and expressions |
| Read logs | Console.getMessages · Console.evaluate | Console messages and Lua evaluation |
| Measure performance | Performance.startRecording · Performance.getFrameDetails · Performance.getHotNodes | Recording, slow frames and node attribution |
| Inspect rendering options | Rendering.getOptions · Rendering.setOption | Development-time runtime A/B |
| Inspect other state | Network.getResources · Accessibility.getFullAXTree · Page.startScreencast | Resources, accessibility tree and screencast |
| Debug storage | Storage.getDOMStorageItems · Storage.setDOMStorageItem | Key-value state held in this service’s memory |
Events are pushed, not command responses
With DOM push enabled, the server can send events such as DOM.childNodeInserted and DOM.attributeModified. It can also push Console.messageAdded, Debugger.paused, Page.screencastFrame and recording completion. Handle events without an id by method, and match responses by id. DOM.disable stops DOM mutation push for a read-only client.
Compatibility endpoints have limits
Page.captureScreenshot and Runtime.evaluate are CDP-style aliases; the latter executes Lua. Some *.enable, Target and ServiceWorker methods only return bootstrap-compatible responses and do not start browser features. Page.reload is not registered; HTML/CSS file watching belongs to a separate HotReload helper. Storage methods operate key-value maps in this DevTools server’s memory, not browser persistent storage. Unknown methods fail. The incoming WebSocket frame limit is 2 MiB; a larger MCP response limit does not raise the request limit.
Treat the connection as privileged
DevTools can read DOM, logs and script state, and can change the UI. The default /json discovery response may contain an authenticated URL. Keep tokens out of shared logs and screenshots. Use the service in a trusted local development environment; prefer an SSH tunnel for remote debugging, and disable or harden it before distribution.
Something unclear?
Report an issue on this page →