pyjab-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
Drives Java desktop applications (Swing/AWT) through Java Access Bridge, via pyjab. It never modifies, restarts or injects into the target application. Start with java_diagnostics if anything looks wrong: it reports which part of the environment is missing instead of failing silently. All tools must run on the same Windows machine as the application. JavaFX is not supported: it publishes accessibility through UI Automation rather than Java Access Bridge, so JAB never sees the window (pyjab#227).
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| java_diagnosticsA | Report whether this machine can drive a Java application right now. Use this first when anything fails, and after installing a JVM or enabling Java Access Bridge. It reports the platform, the interpreter, the installed pyjab and which of its public APIs are present, whether Java Access Bridge is enabled, where the bridge DLL is, and the state of the bridge thread. It is read-only and never writes to the environment: it does not enable Java Access Bridge, because a diagnostics tool that changes what it is reporting on is worse than none. Args: load_bridge: When true, also start the bridge thread first and report whether it came up. This is the end-to-end check; it is off by default so that a mere report cannot load a DLL. Returns:
A multi-line report. A line that could not be measured says
Errors: None for the environment itself: an unusable environment is what this tool reports, so it does not fail because of one. |
| java_list_windowsA | List the Java windows Java Access Bridge can see on this machine. Use this to find out whether the application is visible to JAB at all, and to get a title or hwnd for java_attach_window. If the application is not in this list, nothing else will work and the problem is the attachment or the environment, not a locator -- run java_diagnostics next. Only windows of Java applications are listed; this is not a general Windows window list. Returns: One line per window, with hwnd, pid and title. "No Java windows are visible" is a measurement and is reported as such, not as an empty string. Errors:
|
| java_attach_windowA | Bind to one Java window and return a session id for later calls. Use this after java_list_windows, once you know which window to drive. Give either
an exact Binding is also what arms Java Access Bridge for this server: pyjab loads the DLL, hooks the events and registers the JAB prototypes on the thread doing the binding, so the first attach is slower than the later ones. This never modifies, restarts or injects into the application, and it does not own the process: the application keeps running whatever happens to this session. Args:
title: Window title, matched with fnmatch. Ignored when Returns: A session id, and the window it is bound to. Pass the session id to java_snapshot. Errors:
|
| java_snapshotA | 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 ( 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:
|
| java_findA | 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. 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:
|
| java_get_elementA | Everything known about one element, and whether it is still the same element. Use this after java_snapshot or java_find to look at one control in detail, or to confirm that a handle still points at what it did. The handle is resolved again and compared against what was recorded when it was handed out; if anything differs -- role, name, position among siblings, bounds -- this reports the difference instead of presenting the element as if nothing had changed. Args:
session_id: From java_attach_window.
handle: An Returns: The element's role, name, description, states, bounds, index and depth, its locator, and the verification result. Errors:
|
| java_get_textA | Read the text of an element: a label, a text field, a table cell, a document. Use this on a handle from a snapshot or a find. The same verification applies, so a text field that has been replaced since the snapshot reports the change instead of returning whatever is there now. Long values are cut, and the cut is reported: the reply says how much of the whole text it carries and what the whole text's length is, so a partial read is never presented as the value. Args:
session_id: From java_attach_window.
handle: An Returns: The slice of the element's text, with its length and whether it was cut. Errors:
|
| java_get_tableA | Read a Java table, a page of rows at a time. Use this on a handle for a It never returns the whole table. A large table is 200 rows in pyjab's own test
application and thousands in a real one, so the read is paged by Cells are not just text. A cell with no text interface is shown as Args: session_id: From java_attach_window. handle: A handle for the table element. row_start: First row to read, 0-based. row_count: How many rows to read. max_cells: Hard cap on cells read in one call, whatever the rows ask for. Returns: The table's row and column counts, then one line per row, then what was left out. Errors:
|
| java_clickA | Click an element: a button, a menu item, a check box, a link, a tree node. By default this uses the element's accessibility action, which is what the
application itself exposes: no mouse moves, no window comes to the front, and it works
where there is no interactive desktop. Use The element is checked before it is clicked: role, name, position among siblings and bounds are compared against what the snapshot recorded, and if anything differs nothing is clicked — the difference is reported instead. That is deliberate: a click that lands on whatever moved into the position is worse than a message. Args: session_id: From java_attach_window. handle: The element to click. click: "left", "double" or "right". simulate: Drive real mouse input instead of the accessibility action. Returns: What was clicked and how, so the next call knows what state the window is in. Errors:
|
| java_set_textA | Type into a text field, text area or editable combo box. This sets the text rather than appending to it, and it waits for the field to report
the new value before returning, so a following read sees what was typed. By default it
goes through the accessibility action; Use java_fill_form instead when several fields need values: it is one round trip and it reports each field separately. The element is verified before anything is typed, exactly as java_click describes. Args: session_id: From java_attach_window. handle: The field to type into. value: The text to set. simulate: Type real keystrokes instead of using the accessibility action. Returns: What was set, and a reminder to re-read the field to confirm. Errors:
|
| java_selectA | Select an option in a combo box, list or tab set — or a row or cell in a table. Two shapes, and which one you want is told by the arguments:
The element is verified before anything is selected, exactly as java_click describes. Args: session_id: From java_attach_window. handle: The combo box, list, tab set or table. option: Text to select. Ignored when a row is given. row: Row index to select, 0-based. column: Column index, for one cell rather than the whole row. simulate: Use simulated input where the action supports it. Returns: What was selected, and how. Errors:
|
| java_fill_formA | Fill several fields in one call: a list of A form is usually several fields, and setting them one at a time costs a round trip each. This is the same verification and the same typing, applied in order, with one reply that says what happened to every field. It does not stop at the first failure. A form that is half filled with no report is worse than one that is half filled with one: every field is attempted, and each line says whether it worked and why not. Args:
session_id: From java_attach_window.
fields: Returns: One line per field — set, or the reason it was not — and a count. Errors:
|
| java_send_keysA | Send a keyboard shortcut — Use it for an action the application only exposes as a chord: a menu accelerator, a toolbar shortcut, a keystroke a canvas-drawn control listens for. Nothing is focused and nothing is clicked. The chord goes to whichever window currently has the keyboard focus. That is deliberate on pyjab's side: clicking a control to focus its window would activate that control, and a shortcut usually exists to avoid exactly that. So if a call seems to do nothing, the window probably does not have focus — and
attaching does not focus it (measured in pyjab#180). Call
Chords are written with This needs pyjab 1.11.0, which released Args: session_id: From java_attach_window. keys: The chord, such as "alt+y". Returns: What was sent, and the reminder that a shortcut's effect has to be looked for — this tool cannot see what the application did with it. Errors:
|
| java_focus_windowA | Bring an attached window to the front, and report whether it actually came forward. Use it before The reply is the point, not the action. "I asked for focus" and "the window is now
in front" are two different facts, and this tool answers with the second one. It does so
by reading back the state pyjab left behind, because Windows'
It is not free: when the window is not already in front, pyjab sends a space keystroke first, which is what Windows' foreground-activation rules require of a process that wants the foreground — and that keystroke goes to whatever currently has the focus. A caller that cannot tolerate a stray keystroke elsewhere should not call this. This needs pyjab 1.11.0, which released Args: session_id: From java_attach_window. Returns: Whether the window is now the foreground window, said plainly, with the next step. Errors:
|
| java_wait_forA | Wait for something to happen, instead of asking too early and being told no. Three conditions, chosen by what you pass:
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
Returns: Whether the condition was met, how long it took, and what was seen. Errors:
|
| java_screenshotA | A PNG of the window, or of one element inside it. Use it when the accessibility tree is not enough — a chart, a canvas, a layout problem — and remember what it cannot do: a picture is not readable structure. Anything you want to act on should be found in the tree with java_snapshot or java_find, because that is where the handles and the names are. Canvas-drawn interfaces are the case where this is the only thing that works, and the only thing that is not there. With a handle, the element is verified first, for the same reason an action is: a picture of whatever moved into the position would mislead exactly as a click on it would. Args: session_id: From java_attach_window. handle: Optional element to photograph instead of the whole window. Returns: The image itself, as an image content block. Nothing else: a caption would be text, and everything a caller needs to know is in the arguments it passed. Errors:
|
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 16 tools
Every tool targets a distinct resource or action: discovery (java_list_windows, java_diagnostics), binding (java_attach_window), inspection (java_snapshot vs java_find vs java_get_element vs java_get_text vs java_get_table), and action (java_click vs java_select vs java_set_text vs java_fill_form vs java_send_keys). The descriptions explicitly cross-reference the near-neighbours (set_text → fill_form, send_keys → focus_window, snapshot → find) and state when to prefer which, so an agent can pick correctly. No two tools appear to do the same thing.
All names are snake_case with a uniform `java_` prefix, and most follow verb_noun (java_attach_window, java_get_text, java_fill_form, java_wait_for). A few are noun-only (java_diagnostics, java_screenshot, java_snapshot), which is a minor deviation but still readable and predictable.
Sixteen tools is at the upper edge of comfortable, but each maps to a real step in the drive-a-Java-window workflow (discover, attach, inspect, act, wait) with no filler. The count is justified by the domain's breadth rather than by redundancy.
The surface covers the full lifecycle: environment diagnostics, window discovery, attach, tree/text/table/screenshot inspection, element actions, form filling, keyboard chords, focus, and waiting. Minor gaps remain — no detach/close-session tool, no scrolling or drag-and-drop, and no explicit menu-path helper — but agents can work around these via click and send_keys.