Skip to main content
Glama

get_widget_tree

Inspect the UI structure of a running PySide6 application by retrieving all visible windows and widget details as JSON, then use the returned widget IDs for further interaction.

Instructions

Get the full widget hierarchy of all visible windows as JSON. Each widget has: id, class, object_name, visible, enabled, geometry, text, children. Use widget IDs from this tree in other tools.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pidNoApp pid from launch_app. Omit to target the last launched app. Required only when several apps are running and you need a specific one.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior4/5

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

No annotations are provided, so the description carries the full burden. It discloses that the result is a JSON hierarchy scoped to visible windows, and enumerates the per-widget fields. It does not explicitly state that the operation is read-only, but the getter verb and output-only description make that a safe inference.

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?

Three short sentences, each earning its place: what the tool does, what the output contains, and how to use the result. No filler or redundancy.

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 tool with one optional parameter and an output schema, the description plus schema fully covers invocation and expected results. The visible-window scope and field enumeration leave no significant functional gaps.

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%, and the pid parameter is fully described in the schema, including default behavior and when it is required. The description adds no pid-specific semantics, but the baseline of 3 is appropriate because the schema already carries that weight.

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: 'Get the full widget hierarchy of all visible windows as JSON.' It also signals its role as the source of widget IDs for other tools, which distinguishes it from get_widget_info and find_widget.

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?

Provides clear context: call this tool to obtain the widget tree and use the returned IDs in other tools. It does not explicitly name alternatives or say when not to use it, but the purpose is clear enough for an agent to select it.

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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/com55/pyside6-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server