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

mcp-ht-better-hyperv

by HuanTian3365

hyperv_host_exec

Run PowerShell scripts with Hyper-V administrator rights on the host to perform elevated VM tasks like VHD mounting, GPU partitioning, and VM import or export that a normal shell denies with Access denied.

Instructions

Run a PowerShell script on the HOST machine with Hyper-V administrator rights (elevated). Use this instead of a plain shell tool for any Hyper-V work that needs host administrator access, which a non-elevated shell answers with "Access denied": Get-VMHost*, Get-VMHostPartitionableGpu / Get-VMGpuPartitionAdapter / Add-VMGpuPartitionAdapter, Get-VMProcessor / Set-VMProcessor, Get-VMNetworkAdapter*, Mount-VHD / Dismount-VHD / Optimize-VHD / Resize-VHD / Compare-VHD, Import-VM / Export-VM / Move-VM, Get-VMSnapshot / Checkpoint-VM, Get-VMFirmware / Set-VMFirmware, Get-VMHost*, and reading C:\ProgramData\Microsoft\Windows\Hyper-V (including .vmcx/.vmrs files). Runs on the host, not inside a guest — use hyperv_exec for commands inside a VM. stdout and stderr are merged and returned verbatim, with the elevated process exit code. Elevation is silent when UAC allows it; otherwise the user sees a UAC prompt, and declining it is reported as an error instead of being retried. SCOPE — this tool is for Hyper-V and its virtual machines only. It is not a general administrator shell: do not use it for unrelated system changes, software installation, service or registry edits, reading or writing files the caller could reach by itself, or any script that has nothing to do with Hyper-V or its VMs. If a command needs no host administrator rights, or is not about Hyper-V and its virtual machines, use the ordinary shell tool instead. This boundary is an agreement with the user, not a technical control: nothing in the code rejects a command outside Hyper-V, so keeping to it is the caller's responsibility.

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

Input Schema

NameRequiredDescriptionDefault
commandYesPowerShell source to run elevated on the host. May be multi-line and may contain pipeline syntax; it behaves as one script block.
timeoutMsNoOverall timeout in milliseconds. Default 120000.
workingDirectoryNoDirectory the elevated script starts in. Defaults to the current user's profile directory. Set it explicitly when the script uses relative paths.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

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

With no annotations to lean on, the description still discloses the key runtime traits: stdout and stderr are merged and returned verbatim with the elevated process exit code, elevation is silent when UAC allows it, a UAC prompt may appear, and declining is surfaced as an error rather than retried. It also honestly states the Hyper-V scope boundary is a convention with no technical enforcement.

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

Conciseness3/5

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

The core purpose and elevation behavior are front-loaded well, but the text is bloated: "Get-VMHost*" is listed twice, and the scope restriction is restated in several overlapping sentences ("not a general administrator shell…", "do not use it for…", "If a command needs no host administrator rights…"). The command enumeration and the scope caveat both earn their place, but the redundancy costs it.

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?

Without annotations or an output schema, the description carries the full burden and does so: it covers execution context (host vs. guest VM), privilege/escalation flow, return format and exit code, and the tool's authorized scope. An agent can decide to call it and interpret its result without further information.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents command, timeoutMs, and workingDirectory, including defaults and multi-line behavior. The description adds no parameter-level meaning beyond what the schema provides, so the baseline 3 applies.

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 script on the HOST machine with Hyper-V administrator rights (elevated)." It immediately distinguishes itself from the guest-side sibling ("use hyperv_exec for commands inside a VM") and from a generic shell tool.

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?

Explicitly names alternatives and the conditions that select them: use this for host-elevated Hyper-V work, use hyperv_exec inside a VM, use the ordinary shell tool when no administrator rights are needed or the work isn't Hyper-V related. It even enumerates concrete qualifying command families (Get-VMHost*, Mount-VHD, Import-VM, etc.).

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