hyperv_sequence
Runs a sequence of mouse and keyboard actions inside a Hyper-V VM in one call, cutting round trips between agent and guest by compiling steps into a single script.
Instructions
Run a whole sequence of mouse and keyboard actions in one call, to save the round trips between the agent and this tool. Each elevated call costs several seconds of process startup, so consecutive actions are compiled into a single guest-side script and executed there; only a text step containing non-ASCII characters breaks the sequence into another segment, because that step has to go through the guest clipboard (see hyperv_keyboard). Step types and their fields: click {x, y, button?, count?}; type {text} — routed exactly like hyperv_keyboard (ASCII via TypeText, non-ASCII via clipboard paste, which needs a credential and a logged-on interactive guest session); key {key}; combo {combo}; scroll {x, y, delta}; drag {x, y, toX, toY, button?}; wait {ms}; waitForChange {timeoutMs = 5000, threshold = 0.01, region?} — captures a baseline frame, then re-captures every 500 ms (plus capture time) and succeeds as soon as the ratio of differing pixels exceeds threshold; on timeout the whole sequence fails; region limits the comparison to a rectangle {x1,y1,x2,y2} in guest pixels; screenshot {savePath?} — saves a PNG using the same naming rules and default directory as hyperv_vm_screenshot. Each step is followed by defaultSettleMs (default 250), which a step can override with its own settleMs; a wait step sleeps ms and then the usual settle applies as well. BASIC SESSION ONLY, like hyperv_mouse and hyperv_keyboard: an Enhanced Session Mode (RDP / HvSocket) connection receives no synthetic input, so the sequence refuses to run when that transport is detected instead of silently doing nothing. FAILURE: the first failing step stops everything. The error names the step number, the step type and the reason, and a screenshot of that moment is saved; a waitForChange timeout is reported as TIMEOUT, out-of-range coordinates as INVALID_ARGUMENT. SUCCESS: the result lists how many steps ran, a summary line per step and the path of the last PNG. Coordinates are guest pixels of the current resolution with the origin at the top-left and are validated against Msvm_VideoHead after it is read. This tool is not concurrency safe: it is serialized with other guest input, screenshots and lifecycle calls.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"vm": "<vm>",
"steps": "<steps>"
},
"name": "hyperv_sequence"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| vm | Yes | Name of the Hyper-V virtual machine, as shown by hyperv_vm_list. | |
| steps | Yes | Ordered steps. Each is an object with a type field: click {x,y,button?,count?}, type {text}, key {key}, combo {combo}, scroll {x,y,delta}, drag {x,y,toX,toY,button?}, wait {ms}, waitForChange {timeoutMs?,threshold?,region?}, screenshot {savePath?}. | |
| defaultSettleMs | No | Default pause in milliseconds after each step. Default 250. |