Skip to main content
Glama

app_invoke_element

Press buttons, set text, or expand nodes in WPF dialogs using native UI Automation patterns, avoiding simulated clicks and focus stealing.

Instructions

Press, set or expand an element through UI Automation patterns.

PATTERNS ARE NOT A SIMULATED CLICK. MSAA offers little beyond a default action, which is why the rest of this layer falls back to moving a real mouse. UIA exposes what a control actually implements: Invoke to press, Value to set text, ExpandCollapse to open a node. Those are supported operations, so they move no pointer, take no focus, and cannot land on whatever happens to be under the cursor.

That makes this the right tool for a WPF dialog, and for anything you want done while the user keeps working.

A CLIENT THAT DOES NOT LIST THIS TOOL can still reach it through the dispatcher: tool_invoke(name="app_invoke_element", arguments={"name": "OK", "dialog_title": "Silkscreen"}).

Args: name: the element's name or automation id. A Button of that name is preferred over a label carrying the same text. dialog_title: which dialog. Empty uses the frontmost open dialog, or the main window when no dialog is open. text: set this value instead of pressing. expand: "true" or "false" to open or close a node instead.

Returns: ok with what was done and, for a press in a dialog, dialog_closed; or a refusal naming which pattern the element lacks and its rectangle, so a real click remains possible as a fallback.

Input Schema

NameRequiredDescriptionDefault
nameYes
textNo
expandNo
dialog_titleNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.6.1

TDQS

A4.2/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 most of it: it states that operations move no pointer, take no focus, and cannot hit the wrong element, and it spells out both success ("ok" plus dialog_closed) and failure (refusal naming the missing pattern plus the element rectangle) shapes. It omits any warning that a press mutates application state and may be destructive or non-reversible.

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?

The action statement is front-loaded and the Args/Returns blocks are tight and scannable. The MSAA-vs-UIA paragraph and the dispatcher example are longer than strictly needed, though both do carry real selection information.

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?

For a four-parameter mutation tool with no annotations, the definition covers mechanism, scope, parameter meaning, and both return branches, and an output schema exists so return values need no further elaboration. Missing only environmental caveats such as permission or timing/threading expectations.

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

Parameters5/5

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

Schema coverage is 0%, so the description must document all four parameters itself, and it does: name (element name or automation id, with Button preferred over a same-labelled label), dialog_title (empty means frontmost dialog, else main window), text (set value instead of pressing), and expand ("true"/"false" to open or close a node, which also explains why the parameter is a string rather than a boolean).

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?

Opens with a specific verb set and resource: press/set/expand an element via UI Automation patterns, and the body makes clear this is a pattern-based action rather than a synthetic mouse click. It never names the closest siblings (app_press_dialog_button, app_set_dialog_control, app_expand_tree_node), so the boundary with those is left to inference, which keeps it out of 5 territory.

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?

"That makes this the right tool for a WPF dialog, and for anything you want done while the user keeps working" gives a clear selection criterion, and the Returns section explains the refusal path that tells you when to fall back to a real click. It stops short of naming the alternative tools that would be used instead.

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

Deploy Server

Other Tools