Skip to main content
Glama

desktop_get_window_state

Read a window's UIA accessibility tree and optional screenshot to inspect UI elements, filter results, or diff state for automation.

Instructions

Read a window's Windows UIA accessibility tree (returns element_tokens like s00000001:5) and optional screenshot.

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": {
      "pid": "<pid>",
      "window_id": "<window_id>"
    },
    "name": "desktop_get_window_state"
  }
}

Input Schema

NameRequiredDescriptionDefault
pidYesProcess ID from desktop_list_windows
queryNoOptional case-insensitive substring filter (a|b for either)
sinceNoPass 'latest' or prior snapshot_id for UIA tree diffs
window_idYesHWND window_id from desktop_list_windows
max_elementsNo
include_screenshotNo
max_image_dimensionNo
include_accessibility_treeNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

C2.9/5.0
Behavior3/5

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

With no annotations, the description carries the full burden; 'Read' weakly signals a non-mutating operation and the element_token return format is genuinely useful context. However it omits whether the call has any side effects (focus changes, bringing the window forward), the cost/latency of requesting a screenshot, and the diff semantics implied by the 'since' parameter.

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?

A single front-loaded sentence with no filler, and the return-format detail is placed where it is immediately visible. It is arguably too terse for an 8-parameter tool, but nothing is wasted.

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

Completeness2/5

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

For an 8-parameter, no-annotation, no-output-schema tool, the description leaves major gaps: diff behavior via 'since', filtering via 'query', element-count and image-size limits, and what the screenshot return looks like. The agent cannot call this correctly without reading the schema closely.

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

Parameters2/5

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

Schema coverage is only 50% across 8 parameters; the description mentions only the optional screenshot, adding nothing about query filtering, 'since'/'latest' snapshot diffing, max_elements, or max_image_dimension. Undocumented parameters like since and max_image_dimension remain opaque to the agent.

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

Purpose4/5

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

States a specific verb (Read) and resource (a window's Windows UIA accessibility tree), plus a concrete return artifact (element_tokens like s00000001:5). It does not explicitly contrast with the sibling desktop_get_desktop_state, so an agent must infer the per-window vs whole-desktop distinction.

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

Usage Guidelines2/5

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

No when-to-use guidance and no named alternative, even though desktop_get_desktop_state and desktop_find_image/desktop_ocr_find are obvious competing choices. The only implied guidance is that this is window-scoped rather than desktop-scoped.

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