Skip to main content
Glama

java_find

Read-only

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

NameRequiredDescriptionDefault
nameNo
roleNo
xpathNo
statesNo
session_idYes
descriptionNo
max_resultsNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.9/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Goes well beyond the readOnlyHint/openWorldHint annotations: it explains that handles are re-validated later against role, name, position and bounds, and that a match which cannot be re-located is returned without a handle rather than with a fragile one. It also lists error conditions (unknown session, wrong selector count, unreadable window) and the shape of a no-match response.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loads purpose and the snapshot contrast before the mechanics, and the Args/Returns/Errors structure is easy to scan. It is on the long side and some docstring lines restate parameter names, but at 0% schema coverage that repetition is earning its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a seven-parameter search tool with an output schema and two annotations, the description still supplies the behavioral core: selector exclusivity, handle durability, no-match signaling, and error surface. Nothing an agent needs to invoke it correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description carries the full burden and does: it defines exact-match vs substring semantics for name/description, gives pyjab role spellings, shows the comma-joined states format, gives an xpath example, and ties session_id to java_attach_window. Only max_results is thinly covered, which is the least ambiguous parameter.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('search an attached window', 'get a handle for each match') and explicitly contrasts itself with java_snapshot: 'A snapshot shows you the shape of the window; this asks a question about it.' An agent can pick between the two without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit when-to-use conditions ('when a snapshot is too large to read, or when you know what the control is called'), an explicit selector-count constraint ('exactly one'), and routes substrings to xpath with contains() rather than name/description. When-not guidance is implied through the alternative locator choice.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.