java_snapshot
Inspect an attached Java window as a bounded element tree with handles for later actions, adjusting depth and node limits to prevent oversized output.
Instructions
The bounded tree view of an attached window, one line per element, with handles.
This is the tool to reach for first after attaching: it shows what is in the window,
what each element is called, and a handle ([e:1a2b]) for every element a later
call can name. Pass a handle to a tool that acts on elements; pass a session id
here.
The view is deliberately bounded, and it says so when it was cut short. A Java window can hold thousands of nodes, and returning one puts hundreds of thousands of tokens into the conversation, so read in rings: snapshot at depth 2, then snapshot again if you need to see inside something.
Handles are positions, not references: nothing is held between calls. Each handle records the element's role, name, position among siblings and bounds, and a later call re-finds the element and checks those before doing anything. If the window moved on -- a list reloaded, a dialog replaced a panel -- the handle fails with the difference rather than acting on whatever is there now.
Args: session_id: From java_attach_window. depth: How many levels below the window to read. 2 is a good default; raise it only when the elements you want are not visible at 2. max_nodes: Hard cap on rendered elements. When it is reached the reply says so and names the way to narrow the next read. only_interactive: Drop pure layout scaffolding (panes, panels, viewports). Set it to false when you need the structure rather than the controls, or when an element you expect is missing -- filtering is the usual reason. fields: Extra per-element fields to print: any of states (the default), bounds, description, children, index, depth. Role and name are always printed, because they are what a handle checks itself against.
Returns: One line per element, indented by depth, plus a truncation notice when the view was cut short and a count of elements that have no handle.
Errors:
is_error for an unknown session id (the message lists the live ones), or
when the window can no longer be read -- which usually means the application
closed it.
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": {
"session_id": "<session_id>"
},
"name": "java_snapshot"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| depth | No | ||
| fields | No | ||
| max_nodes | No | ||
| session_id | Yes | ||
| only_interactive | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |