with one click
distill-trace
// Analyze or distill an XMLUI Inspector trace. Use when the user says "analyze the trace", "distill the trace", "what happened in the trace", or wants to understand an exported trace file.
// Analyze or distill an XMLUI Inspector trace. Use when the user says "analyze the trace", "distill the trace", "what happened in the trace", or wants to understand an exported trace file.
| name | distill-trace |
| description | Analyze or distill an XMLUI Inspector trace. Use when the user says "analyze the trace", "distill the trace", "what happened in the trace", or wants to understand an exported trace file. |
| allowed-tools | Read, Bash, mcp__plugin_xmlui_xmlui__xmlui_find_trace |
The user has exported a trace JSON file from the XMLUI Inspector. Your job is to distill the raw log events into a concise step-by-step summary of what happened.
First, call the xmlui_find_trace MCP tool to locate the most recent trace export. Then read that file and follow the algorithm below.
The trace is a JSON array of log event objects. Each event has:
kind — event type: interaction, api:start, api:complete, state:changes, value:change, handler:start, handler:complete, toast, modal:show, modal:confirm, modal:cancel, navigate, app:trace, focus:change, component:vars:inittraceId — groups events that belong to the same user action (e.g. startup-abc123, i-xyz-456)perfTs — high-resolution timestamp (milliseconds since page load), use for orderingts — wall-clock timestamp (fallback if perfTs missing)interaction — a user action (click, keydown, dblclick, contextmenu). Fields:
interaction or eventName — the action typecomponentType, componentLabel — the XMLUI componentariaRole, ariaName — accessible role/name (e.g. button, textbox)uid — component test IDdetail — object with targetTag, text, ariaRole, ariaName, key (for keydown), modifier keys (ctrlKey, shiftKey, metaKey, altKey)api:start / api:complete — HTTP requests made by DataSources. Fields:
method — HTTP method (GET, POST, PUT, DELETE)url or endpoint — the URLresult — response data (on api:complete)body — request body (on api:start, for POST/PUT/PATCH)status — HTTP status codevalue:change — a form control's value changed. Fields:
component — component type (TextBox, Select, etc.)displayLabel — the new display valueariaName — accessible name of the controlcomponentLabel — component ID/labelstate:changes — reactive state mutations. Fields:
diffJson — array of { path, before, after } diffstoast — notification shown to user. Fields:
toastType — success, error, warning, infomessage — toast textnavigate — page navigation. Fields:
from, to — URLsapp:trace — custom trace points emitted by the app. Fields:
label — trace point namedata — arbitrary data objecthandler:start — event handler invoked. Fields:
eventName — handler event (click, submit, didChange, etc.)args or eventArgs — handler arguments (form data, selected item, etc.)Group all events by their traceId. Sort groups by the earliest perfTs in each group.
For each trace group:
Startup group (traceId starts with startup-):
api:complete events → list of { method, endpoint }app:trace events → group by label{ action: "startup", await: { api: [...] } }Interaction group (contains an interaction event):
action and targetNo interaction, no startup prefix → skip (internal framework events)
From the interaction event, build:
{
"action": "<click|keydown|dblclick|contextmenu>",
"target": {
"component": "<componentType or componentLabel>",
"ariaRole": "<ariaRole>",
"ariaName": "<ariaName>",
"label": "<human-readable label>"
}
}
Then scan the other events in the same trace group for:
api:complete events → add await.api array of { method, endpoint }navigate event → add await.navigate: { from, to }value:change events → add valueChanges array of { component, value, ariaName }toast events → add toasts array of { type, message }handler:start with eventName "submit", or from api:start with POST/PUT/PATCH body → add to target.formDataapp:trace events → add appTraces grouped by labelCollapse consecutive textbox keydowns into fill steps: If you see multiple consecutive keydown steps on the same textbox (same ariaName or componentId), collapse them into a single step:
{
"action": "fill",
"target": { "ariaRole": "textbox", "ariaName": "..." },
"fillValue": "<final value from the last value:change on that textbox>"
}
Deduplicate double-clicks: If you see click + click + dblclick on the same target in sequence, keep only the dblclick.
Present the distilled trace as a numbered list of steps. For each step, describe:
For a weather app trace, the output might look like:
Step 1: Startup
- API call: GET /api/weather?city=santa-rosa → returned current conditions
- App loaded weather data for Santa Rosa
Step 2: Clicked the "San Francisco" button
- API call: GET /api/weather?city=san-francisco → returned current conditions
- Value changed: city selector updated to "San Francisco"
- Weather display refreshed with San Francisco data
component:vars:init events (framework internals)unknown (orphaned framework events)