Skip to main content
Glama

wpf_set_text

Sets text or values in WPF UI elements such as TextBoxes and ComboBoxes via UI Automation, with a fallback to direct properties or physical keyboard typing when needed.

Instructions

Set the text/value of a UI element (TextBox, ComboBox, etc.). By default uses UI Automation IValueProvider.SetValue (clean, no focus needed, raises proper events). Falls back to setting TextBox.Text or PasswordBox.Password directly, or a reflected string 'Text' property. Set physical=true to focus the element and type via OS keyboard input (clears existing text with Ctrl+A/Delete first, then types each character; moves window focus). STATE-CHANGING. Target by exactly one of element_handle or automation_id (exact, case-sensitive AutomationProperties.AutomationId). Use root_handle with automation_id to scope lookup; missing or duplicate IDs fail before input.

Input Schema

NameRequiredDescriptionDefault
textYes
physicalNo
root_handleNo
automation_idNo
element_handleNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv0.17.2
    • addedInput schema / properties / automation_id
      Added value: +{
      +  "default": null,
      +  "type": "string"
      +}
    • addedInput schema / properties / element_handle / default
      Added value: +null
    • addedInput schema / properties / root_handle
      Added value: +{
      +  "default": null,
      +  "type": "string"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "element_handle",
      -  "text"
      -]New value: +[
      +  "text"
      +]
  2. First observedv0.1.0

TDQS

A4.4/5.0
Behavior5/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 so well: it declares STATE-CHANGING, notes that physical mode moves window focus and clears text via Ctrl+A/Delete, mentions proper event raising, and states that missing or duplicate automation IDs fail before input. This is rich behavioral context beyond what structured fields provide.

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 core purpose, then mechanics and targeting rules. It is dense but has no filler; a bulleted structure would improve scanability, but every sentence is informative.

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?

Given five parameters, no annotations, no output schema, and mutation behavior, the description covers mechanics, targeting, side effects, and failure conditions. It lacks a note on success return value, but that is a minor gap for a setter-style tool.

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%, but the description documents all five parameters: text, physical (with detailed mechanics), root_handle scoping, automation_id case sensitivity, and mutual exclusivity between element_handle and automation_id. It adds substantial meaning beyond the bare schema types.

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?

States a specific verb ('Set') and resource ('text/value of a UI element'), enumerating element types like TextBox and ComboBox. It does not explicitly name sibling tools such as wpf_set_property, so differentiation is implicit through its text-specific focus rather than stated.

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?

Explains the default UIA behavior, fallback paths, and when to use physical=true with details about focus and clearing existing text. Also states the targeting rule (exactly one of element_handle or automation_id) and root_handle scoping. It does not explicitly say when to prefer wpf_send_keys or wpf_set_property instead.

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