Skip to main content
Glama

handle_dialog

Answers Swing dialogs by pressing buttons or close, entering text, or supplying file paths; waits until the dialog is usable and returns the updated UI snapshot.

Instructions

Answer a dialog like a user: press one of its buttons by text or by role (ok, yes, no, cancel; open/save in file choosers; these work in any UI language), "close" for the window's close box. text first types the answer of an input dialog (or picks it in its combo box); path first puts a file or directory path into a file chooser and, unless button says otherwise, presses its Open/Save button. Without ref: the open modal dialog (or the newest dialog). The result repeats the dialog's title and message. To answer a dialog that an action will open, pass dialog= to that action instead. Waits first (up to timeoutMs) until the component is visible, enabled, editable where needed, and not blocked by a modal dialog or busy overlay, so no wait_for is needed for a component that is about to become usable. Returns the new snapshot.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "handle_dialog"
  }
}

Input Schema

NameRequiredDescriptionDefault
refNoThe dialog (or any component in it); default: the open modal dialog
pathNoFile or directory for a file chooser
textNoAnswer for an input dialog
buttonNoButton text, or ok/yes/no/cancel/open/save, or close
timeoutMsNoHow long to wait for the component to become usable (default 10000)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it explains the implicit wait until the component is visible, enabled, editable, and unblocked, the side effect that path presses Open/Save unless told otherwise, and that the result echoes the dialog title/message. It stops short of saying what happens on timeout or when no dialog exists (error vs. empty result), which is the main remaining behavioral gap.

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?

It is front-loaded with the core action and each sentence adds information about ordering, defaults, or waiting. The semicolon-dense middle section is a bit dense but not padded.

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

Completeness4/5

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

There is no output schema, but the description says the result repeats the dialog title and message and returns a new snapshot, which covers the return value. For a 5-parameter tool with subtle side effects, only failure/timeout behavior is left unstated.

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 100%, so baseline is 3, but the description adds real meaning beyond the schema: text is typed first or picked from a combo box, path fills a chooser and triggers Open/Save, button role words work in any UI language, and ref defaults to the open modal dialog. The interaction ordering between text/path/button is the genuinely additive part.

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 description opens with a concrete verb and resource: "Answer a dialog like a user: press one of its buttons by text or by role." It also distinguishes this tool from the sibling pattern of passing dialog=<button> to an action, so an agent can choose between them without inspecting schemas.

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?

It states the default target (the open modal dialog or the newest dialog), when to use the tool versus the alternative ("To answer a dialog that an action will open, pass dialog=<button> to that action instead"), and the ordering rules for text and path. It also notes that no wait_for is needed because the tool waits internally.

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