Skip to main content
Glama

Ui Focus

ui_focus

Use this to focus an identified native Accessibility/UI Automation field or control prior to keyboard input. It does not insert text; identify the element from a recent snapshot.

Input Schema

NameRequiredDescriptionDefault
idNoElement id returned by ui_snapshot or ui_find. Linux ids are stable per-process accessibility paths and legacy linux:<index> ids remain accepted.
appNoLimit matching to an application/process name substring when available.
pidNoLimit matching to one owning process id when available.
nameNoAccessible name/title substring.
roleNoAccessible role such as Button, Edit, textbox or AXButton.
labelNoCompact numeric label from the most recent ui_snapshot/ui_find; useful for repeated actions without repeating names or coordinates.
deviceYesReMCP device id returned by list_devices. Required for every device operation.
window_titleNoLimit matching to a top-level accessibility window/frame title substring when available.
automation_idNoWindows AutomationId when available.

Output Schema

NameRequiredDescriptionDefault
dataNoAct on UI element structured result for ui_action. Stable fields are declared explicitly; platform-specific fields may be added. Large results may return truncated/bytes/preview instead of the full payload.
textYesConcise human-readable result of the tool call.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare destructiveHint=false and openWorldHint=true, so the safety burden is lighter; the description still adds real value by framing this as a focus-only setup step that never types, and by flagging the snapshot-staleness dependency. It omits behavior on lookup failure (no match, multiple matches) and whether focus raises the window, which the false idempotentHint makes relevant.

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

Conciseness5/5

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

Two sentences, front-loaded with the action and immediately followed by the key exclusion and prerequisite. Nothing is wasted and the ordering puts the differentiator before the caveat.

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?

With an output schema present and annotations covering safety, the description need only cover intent and preconditions, which it does. The remaining gap is selector-precedence and failure-mode behavior across nine matching parameters, but that is a minor omission for a focus primitive.

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

Parameters3/5

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

Schema description coverage is 100%, so all nine selectors (id, label, role, app, pid, automation_id, window_title) are self-documenting; baseline 3 applies. The description adds only the provenance hint that the element should be identified from a recent snapshot, with no guidance on precedence among the many optional selectors.

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 (focus) and resource (native Accessibility/UI Automation field or control), and explicitly scopes it away from text entry with 'It does not insert text.' The word 'native' distinguishes it from browser_focus, computer_focus, and window_focus siblings without requiring schema inspection.

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?

Gives a clear usage condition — call it 'prior to keyboard input' — and a prerequisite that the element come 'from a recent snapshot.' It stops short of naming the actual follow-up tools (type_text, keyboard) or stating what to do when the target is ambiguous, so no explicit alternative routing.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources