Skip to main content
Glama

java_get_element

Read-only

Inspect a single Java UI element by handle and verify it still matches its recorded role, name, position, and bounds, reporting any differences.

Instructions

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 e:... handle from a snapshot or a find.

Returns: The element's role, name, description, states, bounds, index and depth, its locator, and the verification result.

Errors: is_error for an unknown handle (the message says to take a fresh snapshot), for a handle belonging to another session, or when the element has changed.

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>",
      "handle": "<handle>"
    },
    "name": "java_get_element"
  }
}

Input Schema

NameRequiredDescriptionDefault
handleYes
session_idYes

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

Annotations only declare readOnlyHint and openWorldHint; the description adds substantial behavior on top: the handle is re-resolved and diffed against the state recorded at hand-out, and role/name/sibling-position/bounds drift is reported rather than masked. It also enumerates the three error conditions (unknown handle, cross-session handle, changed element) and tells the caller the remedy is a fresh snapshot.

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?

Purpose is front-loaded in the first sentence, with Args/Returns/Errors sections doing predictable work. The Returns block largely restates what the output schema already provides, which is the one portion that doesn't fully earn its space.

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 two-parameter read tool with an output schema and annotations already present, nothing an agent needs is missing: provenance for both params, the staleness-verification contract, and the failure modes are all stated. Return-value detail is duplicated but harmless given the output schema.

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

Parameters4/5

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

Schema coverage is 0%, so the description carries the burden and largely does: session_id is sourced from java_attach_window, and handle is given a format cue ('e:...') plus its origin in a snapshot or find. That goes beyond the bare string types, though it doesn't say what a handle looks like beyond the prefix or whether it is stable across sessions.

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?

The opening line names both jobs precisely: retrieving everything known about one element, and verifying whether it is still the same element. It explicitly distinguishes itself from java_snapshot and java_find, which produce the handles this tool consumes, so an agent can route between them without opening a schema.

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

Usage Guidelines4/5

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

It states exactly when to reach for it: after java_snapshot or java_find to inspect one control in detail, or to re-confirm a handle. It gives clear context but never states a negative case (e.g. use java_find instead when you don't yet have a handle); that guidance is only implied by the prerequisite framing.

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