Skip to main content
Glama
mcp-ht-better-hyperv

mcp-ht-better-hyperv

by HuanTian3365

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

NameRequiredDescriptionDefault
vmYesName of the Hyper-V virtual machine, as shown by hyperv_vm_list.
stepsYesOrdered 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?}.
defaultSettleMsNoDefault pause in milliseconds after each step. Default 250.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.9/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does so: settle timing defaults, segmentation rules for non-ASCII clipboard steps, credential and interactive-session requirements, fail-fast semantics with step number/type/reason, error codes (TIMEOUT, INVALID_ARGUMENT), a screenshot on failure, and the concurrency/serialization contract. This is unusually complete behavioral disclosure for a mutation-heavy input tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with purpose and scoped with clear SUCCESS/FAILURE markers, and nearly every sentence carries operational detail. It is a single dense block, though; a bulleted step-type list would scan faster, and a few clauses (e.g. 'plus capture time') are heavier than needed.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, and the description compensates by describing the success result (step count, per-step summary lines, last PNG path) and the failure payload. For a 3-parameter tool with a nested step union, nothing an agent needs to invoke it correctly appears missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, but the description adds substantial meaning the schema lacks: per-step-type field mapping, waitForChange's baseline/re-capture cadence and pixel-ratio threshold, region in guest pixels, defaultSettleMs default of 250 with per-step settleMs override, and coordinate origin/validation against Msvm_VideoHead. This goes well beyond restating the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Run a whole sequence of mouse and keyboard actions in one call') and immediately frames the batching purpose. It explicitly distinguishes itself from siblings by naming hyperv_keyboard for the type-step routing and hyperv_vm_screenshot for PNG naming, so an agent can tell what this tool subsumes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives an explicit when-to-use rationale (avoiding multi-second elevated process startup per call) and a hard when-not: it refuses to run under Enhanced Session Mode / HvSocket, matching hyperv_mouse and hyperv_keyboard. It also names the alternative path for non-ASCII typing (guest clipboard via hyperv_keyboard), leaving little to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.