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

mcp-ht-better-hyperv

by HuanTian3365

hyperv_exec

Runs PowerShell commands as administrator inside a running Hyper-V guest via PowerShell Direct, returning the guest output and exit code; requires a booted Windows guest with integration services.

Instructions

Run a PowerShell command inside a Hyper-V guest as its administrator, over PowerShell Direct. Returns the guest output verbatim plus the guest exit code. Requires a stored credential (hyperv_credential_set). REQUIRES A LIVE GUEST OPERATING SYSTEM — a powered-on VM is not enough: PowerShell Direct has no channel into a guest that has not booted a Windows OS with the Hyper-V integration services running. If the VM is off it is started automatically and waited for, and then the guest heartbeat is waited on; when no guest ever answers, the tool reports GUEST_UNAVAILABLE and KEEPS the stored credential, because that failure is not a password problem. Use hyperv_vm_list to see each VM's heartbeat, and hyperv_host_exec for host-side work that needs no guest at all. The working directory defaults to whatever the remote session inherits, which is stable but not obvious; set workingDirectory when the script uses relative paths, and the resolved directory is reported back with the output. timeoutMs bounds only the host-side wait: a command already running inside the guest keeps running after this call times out, because the guest is a separate machine. hyperv_host_exec behaves differently — it owns a timer inside the elevated process and does stop its script. It is a Session 0 background session: commands run, but GUI windows it opens are not visible to the user.

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>",
      "command": "<command>"
    },
    "name": "hyperv_exec"
  }
}

Input Schema

NameRequiredDescriptionDefault
vmYesName of the Hyper-V virtual machine, as shown by hyperv_vm_list.
commandYesPowerShell source to run inside the guest. May be multi-line. Runs as the guest administrator.
timeoutMsNoHost-side wait limit in milliseconds. Default 60000.
workingDirectoryNoDirectory the guest script starts in. Defaults to the directory the remote session inherits. Set it explicitly when the script uses relative paths.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.8/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: it discloses that an off VM is auto-started and waited for, that a heartbeat is awaited, that GUEST_UNAVAILABLE preserves the credential, that timeoutMs only bounds the host-side wait while the guest command keeps running, and that it runs in a Session 0 background session where GUI windows are invisible.

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, credential requirement, and the critical live-guest constraint before the operational detail. It is a long description and spends several sentences contrasting timeout behavior with hyperv_host_exec, which is slightly repetitive, though every point still earns its place.

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?

For a 4-parameter tool with no output schema and no annotations, it covers return values (guest output verbatim plus guest exit code), the auto-start behavior, the named failure mode, temporary directory resolution, and timeout scope. An agent has everything needed to invoke it correctly and interpret results.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3; the description still adds real meaning on timeoutMs (it bounds only the host wait, unlike hyperv_host_exec which stops its script) and on workingDirectory (the inherited default is stable but non-obvious, and the resolved directory is reported back with the output). The relative-path advice largely restates the schema field, capping it below 5.

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 PowerShell command inside a Hyper-V guest as its administrator over PowerShell Direct. It explicitly separates itself from hyperv_host_exec (host-side, no guest) and hyperv_vm_list (heartbeat visibility), so an agent can pick it without opening any schema.

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?

Names prerequisites (a stored credential via hyperv_credential_set) and the hard precondition that the guest must have booted a Windows OS with integration services, not merely be powered on. It routes host-side work to hyperv_host_exec and heartbeat checks to hyperv_vm_list, giving explicit when-to-use and when-not-to-use guidance.

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