Skip to main content
Glama

vm_ui_tree

Retrieves a VM window's UI Automation tree as compact JSON so you can inspect controls, text, roles, and bounds without relying on screenshots.

Instructions

The UI Automation tree of a window (default: the foreground one) as compact JSON: role, name, id (AutomationId), class, x, y, width, height, enabled, focused, offscreen, value, children. Empty fields are left out; truncated=true at the root means max_nodes was hit. Read controls and their text exactly this way instead of screenshots when possible.

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": "vm_ui_tree"
  }
}

Input Schema

NameRequiredDescriptionDefault
vmYes
hwndNo
max_depthNo
max_nodesNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations, the description carries the disclosure burden and does a decent job: it states that empty fields are omitted, that truncated=true at the root signals max_nodes was hit, and that hwnd defaults to the foreground window. It never explicitly says the call is read-only or mentions permissions or performance cost, which keeps it below a 5.

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

Conciseness5/5

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

Two sentences, both dense with useful content and no filler. The field list is front-loaded as a scannable enumeration, and the operational caveats follow in the same sentence rather than being buried.

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

Completeness4/5

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

An output schema exists, so the description does not need to document return values, yet it still summarizes the field set, which helps an agent plan. Combined with the truncation and default-window notes, this is close to complete for a four-parameter read tool; only the vm and max_depth semantics are missing.

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 0%, so the description must compensate for all four parameters. It explains the hwnd default (foreground window) and the effect of max_nodes (truncated flag), but max_depth and vm are never mentioned, leaving half the parameters undocumented in both places.

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 states a specific resource (the UI Automation tree of a window), its default scope (the foreground window), and its serialization format (compact JSON with an enumerated field list). The closing sentence distinguishes it from screenshot-based capture, which is a real sibling (vm_screenshot), so an agent can pick this tool without opening a schema.

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 gives explicit usage guidance: read controls and their text "exactly this way instead of screenshots when possible." That names the alternative and the condition that selects it. It stops short of saying when this tool will fail or when vm_ui_act is the better choice, so it is a strong 4 rather than a 5.

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