REFERENCE
Developer tools
80 entries · Page 1 of 1
kui_accessibilityGet the full Accessibility tree (AX tree) of the KUI document. Returns a tree of accessible nodes with roles, names, and properties. Useful for verifying ARIA attributes and screen-reader compatibility.
kui_box_modelGet layout box model quads (content / padding / border / margin) for an element. Returns four 8-float coordinate arrays (clockwise from top-left) plus element width and height in CSS pixels. Args: selector: CSS selector identifying the element
kui_breakpoint_removeRemove a breakpoint by its numeric ID (returned by kui_breakpoint_set). Args: breakpoint_id: Numeric ID returned from kui_breakpoint_set
kui_breakpoint_setSet a breakpoint in a Lua script. Args: source: Script source name or filename (e.g. "main.lua", "ui/handlers.lua") line: 1-based line number to break on condition: Optional Lua expression; break only when it evaluates to true log_message: Optional log message (logpoint — logs but does not pause)
kui_breakpointsList all active breakpoints with their source, line, and condition.
kui_call_stackGet the current Lua call stack (only valid when execution is paused). Returns a list of stack frames with source file, line, and function name.
kui_clickClick at viewport coordinates (CSS pixels) in the KUI window. Args: x: X coordinate (viewport-relative, CSS pixels) y: Y coordinate (viewport-relative, CSS pixels) button: "left" | "middle" | "right" (default "left") click_count: 1 = single click, 2 = double-click modifiers: Bitmask — 1=Alt, 2=Ctrl, 4=Meta, 8=Shift
kui_connectConnect to a running KUI application's DevTools server. KUI's /json endpoint aggregates ALL live KUI targets on the machine (KUI-039 unified discovery), so this discovers every running app/window — not just the one on `port`. Call kui_targets() first to list them. Args: port: DevTools base port to query/scan (default 9229). Discovery also scans the next several ports, so this rarely needs changing. target: Optional selector when multiple apps are running — match by target id (e.g. "kui-9230") or a case-insensitive substring of the title. Empty = pick the app on `port`, else the first one.
kui_consoleGet all console messages (KUI_LOG_INFO/WARN/ERROR) from the KUI application.
kui_debugger_disableDisable the Lua script debugger and remove all breakpoints.
kui_debugger_enableEnable the Lua script debugger. Must be called before setting breakpoints. Requires the KUI app to have called window->attachScriptEngine().
kui_debugger_evalEvaluate a Lua expression in the context of a paused stack frame. Different from kui_eval: this evaluates in the paused frame's local scope, allowing access to local variables and upvalues. Args: expression: Lua expression to evaluate frame_index: Stack frame index (0 = innermost, default 0)
kui_debugger_stateGet the current debugger state: running | paused | disabled. When paused, also returns the current source file and line number.
kui_disconnectStop any leased performance recording and disconnect from DevTools.
kui_dispatch_eventFire a synthetic DOM event on the element matching selector. Args: selector: CSS selector identifying the target element event_type: Event type string, e.g. "click", "input", "my-custom-event" bubbles: Whether the event bubbles up the DOM (default True) cancelable: Whether the event can be cancelled (default True) detail: Optional JSON string stored in event.detail (never eval'd)
kui_domGet the DOM tree or a specific element's properties. Args: selector: CSS selector to locate a specific element. Leave empty to get the full document tree. depth: Tree depth when fetching the full document (1–10, default 3)
kui_element_atFind the topmost element at the given viewport coordinates. Useful after a screenshot: identify which element is at a visual position before clicking or inspecting it. Args: x: X coordinate (CSS pixels, viewport-relative) y: Y coordinate (CSS pixels, viewport-relative)
kui_evalEvaluate a Lua expression in the KUI scripting engine and return the result. Requires the KUI app to have called window->attachScriptEngine(). Args: expression: Lua expression string, e.g. 'document:getElementById("btn"):getAttribute("class")'
kui_event_listenersGet all event listeners attached to the element matching selector. Args: selector: CSS selector identifying the element
kui_eventsCollect push events from KUI for up to 0.5 s and return the last N. Note: In stateless mode this opens a fresh connection and collects whatever push events the server sends within the collection window. Args: count: Maximum number of events to return (default 20)
kui_exception_breaksConfigure exception breakpoints for Lua runtime errors. Args: mode: "none" — never break on exceptions (default) "uncaught" — break only on unhandled errors "all" — break on every error (including pcall'd ones)
kui_force_pseudoForce a CSS pseudo-state on the element matching selector. Useful for inspecting :hover, :focus, :active, :visited styles without actually moving the mouse. Args: selector: CSS selector identifying the element pseudo: Pseudo-state name: "hover" | "focus" | "active" | "visited"
kui_get_styleGet all computed CSS properties for the element matching selector. Args: selector: CSS selector, e.g. "#header", "button.primary"
kui_keySend a keyboard event to the focused element. Common key names: "Enter", "Escape", "Tab", "Backspace", "Delete", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Home", "End", "PageUp", "PageDown", "F1"–"F12", "a"–"z", "0"–"9". Args: key: DOM key name string event_type: "keyDown" | "keyUp" | "char" modifiers: Bitmask — 1=Alt, 2=Ctrl, 4=Meta, 8=Shift
kui_layout_metricsGet viewport and content layout dimensions of the KUI window.
kui_matched_rulesGet the CSS rules that match the element identified by selector. Returns all author and user-agent rules that apply, with their source (inline / stylesheet index / inherited). Args: selector: CSS selector identifying the element
kui_mouse_moveMove the mouse cursor to viewport coordinates without clicking. Args: x: X coordinate (CSS pixels) y: Y coordinate (CSS pixels)
kui_network_resourcesGet all HTTP resources loaded by the KUI document (images, scripts, etc.).
kui_outer_htmlGet the outer HTML markup of the element matching selector. Args: selector: CSS selector, e.g. "#main", ".card:first-child"
kui_page_infoGet KUI page metadata: title, URL, scroll position, viewport size.
kui_pausePause Lua script execution at the next executed line.
kui_perf_bufferRead buffer use, dropped evidence counts, and the suggested lower-cost mode.
kui_perf_capabilitiesReport exact performance schema, modes, limits, and CPU/memory/GPU availability. Availability is explicit: unsupported or failed providers are never returned as a numeric zero. This call does not start recording.
kui_perf_capture_interactionRecord one interaction in a single call and return a compact per-frame summary. Sequence (one WebSocket): optional warm-up action → start recording → wait `warmup_ms` → perform the input → wait `settle_ms` → stop. Then reads the frozen recording and returns only frames that did style/layout/paint work, trimmed like kui_perf_record_get(detail="compact"), plus totals. In attribution mode it also returns layout-run nodes grouped by their topology-transfer outcome and the top `node_limit` layout nodes. The session id is remembered, so kui_perf_frame / kui_perf_hot_nodes / kui_perf_node_history can drill down afterwards. Args: action: click | key | type | none (none = just record `warmup_ms+settle_ms`). selector: click target; its border-box center is used (overrides x/y). x, y: click position in viewport CSS pixels when no selector is given. key: DOM key name for action="key" (keyDown + keyUp). text: characters for action="type". modifiers: 1=Alt, 2=Ctrl, 4=Meta, 8=Shift. mode: timeline (timing only, lowest overhead) | attribution | deep-trace. warmup_action: perform the same input once before recording, so the recorded pass is not a first-time (cold cache) run. warmup_ms: delay between start and input. settle_ms: delay after input before stopping (and after the warm-up). max_frames: retained-frame cap for this recording. node_limit: top layout nodes listed (attribution modes).
kui_perf_export_recordingExport a stopped recording as one bounded, privacy-redacted JSON payload. Args: session_id: Recording id; empty uses the last session. confirm_export: Must be true to assert an explicit user-approved export. max_bytes: UTF-8 payload limit, 1024..4194304 bytes. The engine excludes DOM text, input values, URLs, tokens, selectors, element ids/classes, and stable GPU adapter/engine identifiers. Active recordings must be stopped first so the returned payload is atomic.
kui_perf_frameRead exact phase, work, damage, layer, DOM, and display-list data for one frame. Args: frame_id: Frame id from a recording page. session_id: Recording id; empty uses the last session. detail: full (default, raw protocol frame) | compact (same trimming as kui_perf_record_get).
kui_perf_hot_nodesRank high-frequency nodes by invalidation, style, layout, paint, or DL work. Attribution mode is required for node-level results. `detail="compact"` (default) returns each node's identity, non-zero counters and its `layoutTopologyTransfer` outcome only; `detail="full"` returns the raw protocol page. `min_layout_runs > 0` switches to layout ranking, pages through the recording until nodes fall below the threshold, and adds `layoutRunsByTransferOutcome` (nodes and layout runs grouped by the node's last topology-transfer outcome). Args: session_id: Recording id; empty uses the last session. sort_by: estimatedCost | dirty | style | layout | paint | displayList | raster (DeepTrace submitted drawable ops; not GPU completion). limit: Maximum nodes returned (1..200; with min_layout_runs, the cap on listed nodes — grouping still covers every qualifying node). detail: compact | full. min_layout_runs: Only nodes whose layout algorithm ran at least this often.
kui_perf_insightsReturn evidence-backed dirty/style/layout/paint/damage/resource/buffer cards.
kui_perf_node_historyRead ordered dirty events, related update passes, and node totals.
kui_perf_record_getRead a retained recording page, including summary, work, and resources. This is an explicit read; the MCP server never polls in the background. Follow `hasMore=true` using the returned `cursor` to page through long runs. `detail="compact"` (default) keeps each frame's timing, non-zero work counters, layout path / sub-phase timing, topology-transfer statistics and a few render fields, and drops per-sample memory-category descriptions; values are not altered. Use `detail="full"` for the raw protocol payload. Args: session_id: Recording id; empty uses this MCP process's last session. cursor: Return frame ids greater than this cursor (default 0). max_frames: Maximum returned frames for this page (1..512). resource_cursor: Return resource sequences greater than this cursor. max_resource_samples: Maximum resource samples for this page (1..512). detail: compact | full. layout_frames_only: compact only — omit frames that did no layout work (the omitted count is reported as framesOmitted).
kui_perf_record_startExplicitly start a bounded fine-grained render recording. The MCP transport opens a new WebSocket for each tool call, so this always requests `lifecycle=leased`; closing that short-lived socket must not stop the recording. Always finish with kui_perf_record_stop(), then retrieve the retained evidence with kui_perf_record_get(). To measure one interaction (click / key / typing), prefer kui_perf_capture_interaction(): it records, performs the input and stops in a single call, so agent latency between tool calls cannot end the recording. The recording stops by itself when `max_duration_ms` elapses (stopReason "timeout") or when no tool call touches the session for `lease_ttl_ms` (stopReason "lease-expired"). Agent tool calls are often tens of seconds apart, so both defaults are 120 s here. Args: mode: summary | timeline | attribution | deep-trace. max_frames: Retained-frame cap (1..4096). max_duration_ms: Automatic duration cap in milliseconds (stopReason "timeout"). resource_interval_ms: CPU/memory sample interval (minimum 250 ms). gpu_sampling: Opt in to Windows PDH GPU sampling; may affect tail latency. lease_ttl_ms: Stop after this long without a session call (stopReason "lease-expired"). node_details: Promote timeline to attribution for per-node evidence. categories: Optional timing/work/render/resources/updatePasses/nodes/trace subset. max_nodes: Attribution node cap; 0 uses the engine default. buffer_size: Requested bounded buffer budget in bytes; 0 uses defaults.
kui_perf_record_stopExplicitly stop a fine-grained recording without discarding its evidence. Args: session_id: Recording id; empty uses the last session started by this MCP process.
kui_perf_resolve_nodeResolve a recorded node to a stable session/document-scoped identity. The returned backendNodeId is stable only within the recording's document epoch. Use kui_perf_reveal_node() for a fresh Elements-panel locator; never persist the ephemeral DFS selector.
kui_perf_reveal_nodeReveal a live recorded node in Elements using a fresh DOM locator. Args: performance_node_id: Session-scoped node id returned by hot-nodes. document_epoch: Exact epoch returned by start/resolveNode. session_id: Recording id; empty uses the last session. highlight: Also paint the DevTools highlight overlay. Frozen, detached, or epoch-mismatched nodes return an explicit unavailable result instead of an unsafe stale selector.
kui_perf_traceRead one bounded DeepTrace event page. Events contain paint-owner DisplayList ranges, concrete backend replay receipts, operation-type distributions, surface metadata, and present-call receipts. GPU/display completion remains explicitly unsupported unless a backend provider reports it.
kui_performanceGet performance metrics: frame time, layout count, paint count, etc.
kui_profile_startStart the Lua script profiler, not a renderer/process CPU profiler.
kui_profile_stopStop Lua script profiling and return data marked profileKind=lua.
kui_reloadReload the HTML document currently loaded in the KUI window.
kui_remove_attrRemove an HTML attribute from the element matching selector. Args: selector: CSS selector identifying the element name: Attribute name to remove (e.g. "disabled", "class")
kui_remove_styleRemove an inline CSS property (element.style) from the element matching selector. Works on any element, whether or not it has an HTML `id` attribute. Args: selector: CSS selector, e.g. "#header", "button.primary" prop: CSS property name to remove (e.g. "color", "display")
kui_render_optionGet or set runtime render-optimization toggles (FR-DEVTOOLS-RENDEROBS-004). With no `name`, returns the current options (retainedDLSkip, retainedSurface, layerPromotion, partialDamage, selectiveLayout, ifcAlternateSlot, layerLimit) with their value/availability. Turning `ifcAlternateSlot` off releases every IFC result-cache second slot (one laid-out SkParagraph each) immediately. With a `name`, flips that optimization live (bool options use `enabled`; layerLimit uses `value`). Args: name: option to set; empty = list all. enabled: target on/off for boolean options. value: integer value for layerLimit (>=0); ignored for bools.
kui_render_statsGet render-mode stats (FR-DEVTOOLS-RENDEROBS). Returns a summary (framesPainted/framesReused/skipRate, work-fps vs present-fps, layer R/C/S counts, partialDamageEnabled, plus animationSources — KUI-070 idle full-frame diagnosis: the per-source breakdown of what keeps the engine producing a frame every vblank: animationTimerActive (master switch; false = on-demand rendering engaged, frame-skip NOT regressed), activeTransitions, activeAnimations, lottie, view3d, scriptRaf) plus the most recent `window` per-frame records (mode = full|partial|layer|skipped). Enabling this also turns on the per-frame repaint recording ring. Args: window: number of recent frames to include (max 240).
kui_repaint_rectsGet the rectangles that repainted, incrementally since a frame index. Returns {frames:[{i,mode,overflow,rects:[{x,y,w,h}]}], lastFrame}. Poll with since_frame = lastFrame to stream only new repaints (the data behind the DevTools paint-flashing overlay). Args: since_frame: only return frames with index > this (0 = all recent).
kui_resumeResume Lua script execution after a breakpoint or pause.
kui_scopeGet local variables and upvalues for a call stack frame. Args: frame_index: 0-based index into the call stack (0 = innermost frame)
kui_screencast_saveCollect screencast frames for 3 s and save each as a numbered PNG file. Args: output_dir: Directory to write frame_0000.png, frame_0001.png, etc. max_frames: Cap on frames to save (avoids huge dumps, default 100)
kui_screencast_startStart continuous frame capture (screencast). KUI will push Page.screencastFrame events for every N-th rendered frame. Collect them with kui_events() or kui_wait_event('Page.screencastFrame'). Args: every_nth_frame: Capture interval — 1 = every frame, 2 = every other, etc. Higher values reduce overhead. Default 2.
kui_screencast_stopStop the running screencast and flush any remaining frames.
kui_screenshotCapture a PNG screenshot of the KUI window and save it to disk. Args: output_path: Destination file path for the PNG. Absolute path recommended; relative = working directory.
kui_script_sourcesGet all Lua script source files known to the debugger. Returns source names, line counts, and whether each script is currently loaded.
kui_scrollScroll at the given coordinates. Args: x: X coordinate of scroll origin (CSS pixels) y: Y coordinate of scroll origin (CSS pixels) delta_x: Horizontal scroll delta in pixels (positive = right) delta_y: Vertical scroll delta in pixels (positive = down, default 120)
kui_scroll_infoGet the current document scroll position and total scrollable height.
kui_scroll_toScroll the document to the given vertical position. Args: y: Target scroll Y position in CSS pixels
kui_sendSend any CDP command to KUI and return the raw JSON response. Use this for commands not covered by the specialized kui_* tools. Args: method: CDP method, e.g. "DOM.getDocument", "CSS.getMatchedRules" params_json: JSON object string of parameters, e.g. '{"depth": 3}'
kui_set_attrSet an HTML attribute on the element matching selector. Args: selector: CSS selector name: Attribute name (e.g. "class", "data-active", "disabled") value: Attribute value string
kui_set_htmlReplace the inner HTML of the element matching selector. Args: selector: CSS selector identifying the element html: HTML markup to set as innerHTML
kui_set_styleInject a CSS rule targeting selector into the document. This uses CSS.addRule which appends a new rule to the document's dynamic stylesheet — it does not overwrite existing rules. Args: selector: CSS selector for the new rule (e.g. "#box", ".item:hover") css_text: CSS declarations without braces (e.g. "color: red; display: none") Example: kui_set_style("#hero", "background: linear-gradient(#f00,#00f); opacity: 0.8")
kui_set_style_propertySet a single inline CSS property (element.style) on the element matching selector. Unlike kui_set_style (which injects a new stylesheet rule), this edits the element's own inline style — the highest-priority, single-element override, equivalent to what the DevTools Styles panel's "element.style {}" section edits. Args: selector: CSS selector, e.g. "#header", "button.primary" prop: CSS property name (e.g. "color", "display") value: CSS value (e.g. "red", "flex") important: set the `!important` priority flag
kui_set_textSet the text content of the element matching selector. Args: selector: CSS selector identifying the element text: Plain text to set as the element's text content
kui_statusReturn current connection status plus all discoverable KUI targets.
kui_stepStep through Lua script execution. Args: action: "over" — step over the current line (do not enter function calls) "into" — step into function calls "out" — step out of the current function
kui_storage_clearClear all KUI in-memory storage (both localStorage and sessionStorage).
kui_storage_get_allGet all key-value pairs from KUI's in-memory localStorage or sessionStorage. Args: local: True = localStorage (default), False = sessionStorage
kui_storage_removeRemove a key from KUI's in-memory localStorage or sessionStorage. Args: key: Storage key to remove local: True = localStorage (default), False = sessionStorage
kui_storage_setSet a key-value pair in KUI's in-memory localStorage or sessionStorage. Args: key: Storage key string value: Value string to store local: True = localStorage (default), False = sessionStorage
kui_targetsList all live KUI applications/windows discoverable on localhost. Thanks to KUI-039 unified discovery, KUI's /json endpoint aggregates every live target across processes; this scans from `port` upward and returns the de-duplicated set. Use the printed id/title with kui_connect(target=...). Args: port: Base port to query/scan (default 9229).
kui_timelineGet the performance event timeline (layout, paint, composite events).
kui_typeType a string into the currently focused KUI element (char-by-char). Args: text: Plain text string to type. No escape sequences.
kui_wait_eventBlock until KUI pushes a specific event, then return it. Useful for waiting for DOM mutations after a click before asserting state. Common event names: "DOM.childNodeInserted", "DOM.childNodeRemoved", "DOM.attributeModified", "DOM.characterDataModified", "Console.messageAdded", "Page.screencastFrame" Args: event_name: CDP event method name to wait for timeout: Maximum seconds to wait (default 5.0)