java_wait_for
Wait for a Java window to appear or an element's text to equal or change from a value, returning whether the condition was met, elapsed time, and observed state.
Instructions
Wait for something to happen, instead of asking too early and being told no.
Three conditions, chosen by what you pass:
window_title="A Dialog"— wait until a Java window with that title (fnmatch, so"*Progress*"works) exists. Use it after an action that opens one.handle=..., text_equals="Saved"— wait until that element's text is this.handle=...alone — wait until its text changes from what it reads when the wait starts, and report both values.
A timeout is a result, not an error. The reply says the condition was not met and what was seen instead, because "not yet" is information an agent can act on — it can wait longer, look somewhere else, or take a snapshot — while an error reads as a failed call. pyjab's own waits raise; this one reports, and the difference is deliberate for a tool a model is driving.
The waiting happens here rather than inside pyjab, and that is also deliberate: the bridge has exactly one owning thread, so a wait that ran on it would block every other call for its whole duration. This polls between calls instead, which also means a client can cancel it.
Args:
session_id: From java_attach_window.
window_title: Title (fnmatch) of a window to wait for.
handle: An element whose text to watch.
text_equals: The text to wait for, with a handle.
timeout: Give up after this many seconds.
poll_interval: Seconds between checks. A window wait re-lists the Java windows
on every poll; on an install below the pin that listing is the
pyjab-inspect subprocess rather than a bridge call, so raise this.
Returns: Whether the condition was met, how long it took, and what was seen.
Errors:
is_error only for an unknown session or handle, or for no condition at all.
A timeout is reported in the reply, not as an error.
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_wait_for"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| handle | No | ||
| timeout | No | ||
| session_id | Yes | ||
| text_equals | No | ||
| window_title | No | ||
| poll_interval | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |