Skip to main content
Glama
tiefeiyu
by tiefeiyu

qt_prune_snapshot

Compute actual visibility from a saved Qt UI snapshot: remove fully occluded elements, mark partial visibility, and output a pruned tree to identify which element is on top before clicking.

Instructions

Occlusion-prune a saved snapshot.

snapshot_id is the value returned by the last qt_snapshot call of this session. When to use: after a snapshot, when elements overlap inside the same window and you need to know which one is really on top / how much of a target is visible — e.g. before deciding which element to click or whether a covered element matters.

Reads the saved snapshot JSON and computes what is actually visible: elements fully covered by higher-z opaque elements are removed (their still-visible descendants are reparented up), partially covered ones get a visible_ratio field, fully hidden (opacity 0) elements are dropped. Writes snapshot_<id>_pruned.json next to the original — read the tree at the returned uri (same objIDs as the source snapshot plus visible_ratio annotations). Result field pruned = {"removed", "kept", "removed_ratio"}; window roots are never removed.

The solver is a geometric heuristic (axis-aligned rects, per-window z-order with same-z tree order; widgets and QML rectangles/images occlude unless semi-transparent, transparent containers, text and custom QML components do not; a parent never occludes its own children). Occlusion is per top-level window on purpose: the agent must stay able to operate an app that the user has covered or minimised, so windows never occlude each other. The objIDs in the pruned file expire with the next snapshot/find refresh like any other id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idYes
snapshot_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

With no annotations provided, the description carries the full burden and excels. It details the geometric heuristic, occlusion rules (e.g., 'widgets and QML rectangles/images occlude unless semi-transparent'), per-window behavior, file writing, and objID expiration. This provides deep transparency beyond basic read/write semantics.

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 description is front-loaded with a clear one-line purpose and is organized into coherent sections (when to use, behavior, solver details, output). It is longer than average but every sentence adds essential information about a complex algorithm. Slight verbosity around the heuristic details prevents a 5.

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 no annotations and a nontrivial algorithm, the description is remarkably complete. It covers input requirements, output file, result field, edge cases (partial overlap, opacity, child reparenting), limitations (per-window occlusion), and lifecycle of objIDs. The presence of an output schema reduces the need to describe return values, allowing the description to focus on behavior.

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 description coverage is 0%, so the description must compensate. It does explain the key parameter: 'snapshot_id is the value returned by the last qt_snapshot call of this session.' session_id is implied by context but not explicitly detailed. Since there are only two parameters and one is fully clarified, it earns above-baseline score but not a 5.

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: 'Occlusion-prune a saved snapshot.' It clearly distinguishes this tool from siblings like qt_snapshot by explaining it computes visibility and removes covered elements, which is a unique purpose.

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?

The description explicitly states when to use the tool: 'after a snapshot, when elements overlap inside the same window and you need to know which one is really on top / how much of a target is visible.' It gives concrete examples like deciding which element to click, but does not explicitly mention when not to use it or name alternative tools, so it falls short of a 5.

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

Install Server

Other Tools

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/tiefeiyu/qt-commander'

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