VisualTree
Register the VisualTree tool suite to inspect the live UI hierarchy and capture screenshots from a paired .NET app.
Install
dotnet add package Ansight.Tools.VisualTree
Register the Suite
using Ansight;
using Ansight.Tools.VisualTree;
var options = Options.CreateBuilder()
.WithVisualTreeTools()
.WithReadOnlyToolAccess()
.Build();
Registration API
WithVisualTreeTools(): registers the full visual tree and screenshot suite. No suite-specific configuration is currently required.
Specific Concerns
- The tools inspect the foreground scene only.
- Screenshot capture exports rendered UI content, so treat it as sensitive.
includeComputedStylesand detailed node inspection can reveal UI labels and accessibility metadata.
Tool Matrix
| Name | Id | Scope | Description | Security |
|---|---|---|---|---|
Get Visual Tree | ui.get_visual_tree | Read | Returns the current UI hierarchy for the foreground scene. | High |
Get Screenshot | ui.get_screenshot | Read | Captures a screenshot of the current app scene. | High |
Inspect Node | ui.inspect_node | Read | Returns detailed metadata for a visual tree node. | High |
Get Visual Tree
Arguments:
includeBounds: include node bounds, defaulttrueincludeComputedStyles: include implementation-specific properties, defaultfalsemaxDepth: child depth limit, default8rootNodeId: optional subtree root
Returns:
platformcapturedAtUtcroot
Example:
{
"toolId": "ui.get_visual_tree",
"arguments": {
"includeBounds": true,
"includeComputedStyles": false,
"maxDepth": 6
}
}
Get Screenshot
Arguments:
format:pngorjpegquality: JPEG quality1-100maxWidth: optional width capannotateNodeIds: overlay node ids on the screenshot
Returns:
platformcapturedAtUtcformatwidthheightbase64annotationApplied
Example:
{
"toolId": "ui.get_screenshot",
"arguments": {
"format": "jpeg",
"quality": 85,
"maxWidth": 1080,
"annotateNodeIds": false
}
}
Inspect Node
Arguments:
nodeId: required node identifierincludeAncestors: include ancestor chainincludeDescendants: include descendantsincludeProperties: include implementation-specific properties
Returns:
platformcapturedAtUtcnode- optional
ancestors - optional
descendants
Example:
{
"toolId": "ui.inspect_node",
"arguments": {
"nodeId": "root/stack[0]/button[1]",
"includeAncestors": true,
"includeDescendants": false,
"includeProperties": true
}
}