Skip to main content
Glama

java_screenshot

Read-only

Captures a PNG of a Java window or specific element when the accessibility tree cannot represent charts, canvases, or layout issues; use it for visual inspection, not for finding actionable elements.

Instructions

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: is_error for an unknown session or handle, an element that changed, or a window whose geometry is not reported — there is nothing to grab then, and saying so beats an empty image.

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

Input Schema

NameRequiredDescriptionDefault
handleNo
session_idYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare readOnlyHint and openWorldHint, but the description adds real behavior: the handle is verified before capture so a stale/moved element fails rather than producing a misleading image, and errors are returned for unknown session, unknown handle, changed element, and unreported geometry. It also states the return is a bare image content block with no caption. It stops short of describing image format details or size/scaling behavior, which keeps it off a 5.

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 with the one-line purpose, then structured Args/Returns/Errors sections. A few rhetorical flourishes ("a picture is not readable structure", "the only thing that is not there") add emphasis but also length; the core content is dense and earns 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?

With no output schema, the description fully covers what comes back (an image content block, no caption) and the failure modes. For a two-parameter read tool with annotations already covering safety, 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.

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 must carry both parameters — and it does: session_id is sourced from java_attach_window, and handle is described as an optional element to photograph instead of the whole window, with verification semantics attached. The only gap is that the handle string's origin/format is implied via the java_snapshot/java_find reference rather than stated for this argument.

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 sentence states a concrete verb and resource: a PNG of the window or of one element inside it. It immediately separates itself from the tree-based siblings by naming java_snapshot and java_find as the tools that yield actionable structure, so an agent can pick 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 Guidelines5/5

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

Explicit when-to-use (chart, canvas, layout problem where the accessibility tree is insufficient), explicit when-not-to-use (anything you intend to act on belongs in the tree), and named alternatives. It even flags the canvas case as the one where this tool is both the only option and the only thing unavailable in the tree.

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