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

mcp-ht-better-hyperv

by HuanTian3365

hyperv_vm_screenshot

Capture the current screen of a running Hyper-V VM as a PNG, returning the image and file path, with optional region cropping and a custom save location.

Instructions

Capture the current screen of a running Hyper-V virtual machine, save it as a PNG, and return both the absolute file path and the image itself. The frame comes from the hypervisor's synthetic video device (GetVirtualSystemThumbnailImage), so it is exactly the guest's current resolution and is decoded from an RGB565 buffer: expect slight color banding compared with a real screenshot, and expect large resolutions (4K) to be noticeably slower to capture and convert. No guest OS, credential or PowerShell Direct is involved; the VM only has to be Running. A NEARLY BLACK IMAGE IS USUALLY NOT A FAILURE: while an Enhanced Session Mode connection is active, or when no basic session is connected at all, the framebuffer the hypervisor exposes is simply empty and the PNG comes out black. A guest whose display has gone to sleep looks the same until something wakes it, and the result text says so when it happens. region is an optional crop rectangle in guest pixels with the origin at the top-left; it must fit inside the current resolution, and an out-of-range region is rejected as INVALID_ARGUMENT instead of being silently clamped. savePath takes any absolute path: an existing directory, or a path with no extension, receives the generated name -.png, while a path ending in .png is used verbatim and overwritten. Any other extension, or a relative path, is rejected as INVALID_ARGUMENT. Without savePath the file goes to /screenshots/, where dataDir is DATA_DIR or the default ~/.mcp/data/dsh-ht-better-hyperv. An existing generated name gets a numeric suffix instead of being overwritten. Errors: VM_NOT_FOUND for an unknown name, VM_NOT_RUNNING when the VM is not Running, HYPERV_UNAVAILABLE when no resolution can be read, and GUEST_ERROR when the capture API returns a non-zero code — the code and its meaning are in the message, and 32775 (Invalid state for this operation) most often means the requested size is larger than the guest's current resolution.

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

Input Schema

NameRequiredDescriptionDefault
vmYesName of the Hyper-V virtual machine, as shown by hyperv_vm_list.
regionNoOptional crop rectangle in guest pixels, origin at the top-left of the guest's current resolution. It must fit inside that resolution: x2 > x1, y2 > y1, x2 <= width, y2 <= height. Out-of-range values are an error, never clamped.
savePathNoWhere to write the PNG. Absolute path only, no directory restriction. A directory (or a path without an extension) gets the generated file name <vm>-<yyyyMMdd-HHmmss>.png; a path ending in .png is used as-is and overwritten. Any other extension is an error. Defaults to <dataDir>/screenshots/.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

With no annotations supplied, the description carries the full behavioral burden and does so thoroughly: it identifies the hypervisor thumbnail API, RGB565 decoding, color banding, slower 4K capture, black-image conditions under Enhanced Session Mode or sleep, file overwrite/numeric-suffix behavior, and specific error codes. This is unusually rich disclosure for a capture 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?

The definition is front-loaded with the action and then moves through source behavior, caveats, parameter rules, and errors in a logical order. It is long, but nearly every sentence adds operational value; the main cost is some overlap with the already detailed schema.

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 three-parameter capture tool with no output schema and no annotations, the description covers return values, defaults, overwrite behavior, timing implications, black-image interpretation, and error conditions. Nothing an agent needs in order to call it correctly appears to be missing.

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 schema already defines the three parameters well. The description still adds useful semantics beyond the schema: out-of-range regions are rejected as INVALID_ARGUMENT rather than clamped, generated names receive numeric suffixes instead of overwriting, and relative or wrong-extension savePath values are rejected.

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?

The description opens with a specific verb and resource: capture the current screen of a running Hyper-V VM, save it as PNG, and return both the path and image. This is clearly distinguishable from sibling tools such as hyperv_keyboard, hyperv_mouse, and hyperv_exec.

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

Usage Guidelines4/5

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

It specifies the key precondition that only a Running VM is required and explicitly says no guest OS, credentials, or PowerShell Direct are involved. It also explains when a black image is expected rather than a failure, though it does not name alternative tools or say when not to use this one.

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