Skip to main content
Glama

java_get_text

Read-only

Reads text from a Java UI element handle, returning a bounded slice with its length and cut status; reports changed or non-text elements instead of returning stale or misleading values.

Instructions

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 e:... handle from a snapshot or a find. start: Character to start at, 0-based. length: How many characters to return.

Returns: The slice of the element's text, with its length and whether it was cut.

Errors: is_error for an unknown handle, a handle from another session, an element that has changed, or an element with no text at all -- which is reported as such, because "this control has no text" and "this control is empty" are different answers.

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_text"
  }
}

Input Schema

NameRequiredDescriptionDefault
startNo
handleYes
lengthNo
session_idYes

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior5/5

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

Beyond the readOnlyHint/openWorldHint annotations, it discloses three behaviors that matter: staleness detection (a replaced text field reports the change rather than silently returning current content), truncation with an explicit cut report so a partial read is never mistaken for the whole value, and the distinction between "no text" and "empty text" in the error contract. These are exactly the failure modes an agent needs to anticipate.

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-loaded purpose sentence, then a scoping paragraph, then structured Args/Returns/Errors sections that make scanning easy. A few clauses are slightly rhetorical ("a partial read is never presented as the value"), but they carry real semantic content rather than padding.

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?

The tool is read-only but has non-obvious semantics: handle staleness, truncation, and a no-text-versus-empty-text distinction. The description addresses all three, plus the error surface, and it adds value even though an output schema already exists by explaining what the cut metadata means.

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 description coverage is 0%, so the description carries the parameter burden, and it does: session_id's origin, the ``e:...`` handle format and where it comes from, 0-based semantics for start, and length as a character count. It omits the schema's declared defaults (start=0, length=2000) and does not say what happens when start exceeds the text length.

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

Purpose4/5

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

The description opens with a specific verb and resource ("Read the text of an element") and enumerates concrete element types (label, text field, table cell, document), which makes the scope immediately legible. It does not explicitly differentiate itself from the adjacent java_get_element or java_get_table, leaving the agent to infer that boundary from names alone.

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 the precondition clearly: "Use this on a handle from a snapshot or a find," and the session_id arg is annotated as coming from java_attach_window, so the caller knows how to obtain inputs. It offers no explicit when-not condition or named alternative for reading element metadata or tables, which keeps it short of a 5.

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