java_find
Searches an attached Java window for controls by name, role, states, or xpath and returns a handle plus locator for each match, so you can target a control without walking the full accessibility tree.
Instructions
Search an attached window and get a handle for each match.
Use this when a snapshot is too large to read, or when you know what the control is called and do not want to walk the tree to find it. A snapshot shows you the shape of the window; this asks a question about it.
Give exactly one selector. name and description are exact matches -- for a
substring use xpath with contains(), which is pyjab's locator syntax:
//push button[@name=contains('Save')]. states takes a comma-joined list such as
"enabled,showing".
Every match gets a handle, and a handle is checked before it is used: the locator recorded here is resolved again later and compared against the role, name, position and bounds seen now. If a match cannot be given a locator that finds it again, it is listed without a handle rather than with one that might resolve to something else.
Args: session_id: From java_attach_window. name: Exact accessible name. role: Role, as pyjab spells it: "push button", "text", "check box", "table". description: Exact accessible description, for controls with no name. states: Comma-joined states, e.g. "enabled,showing". xpath: A pyjab locator, for substrings, unions and paths. max_results: Stop after this many matches.
Returns: One line per match with its handle and locator, or a measurement that nothing matched -- with the selector that found nothing in it, so the next attempt can be narrower rather than identical.
Errors:
is_error for an unknown session id, for no selector or more than one, or when
the window can no longer be read.
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_find"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | ||
| role | No | ||
| xpath | No | ||
| states | No | ||
| session_id | Yes | ||
| description | No | ||
| max_results | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |