Skip to main content
Glama

Select text

select_text
Idempotent

Select a character range inside a text element through the accessibility API to copy or replace part of a value without modifying the text.

Instructions

Select a character range inside a text element through the accessibility API, for example to copy part of a value or to replace just that part with type_text. Defaults to selecting from start to the end of the value. Use set_value to replace the whole value instead. Only the selection changes; the text is not modified.

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": {
      "element_id": "<element_id>"
    },
    "name": "select_text"
  }
}

Input Schema

NameRequiredDescriptionDefault
startNoZero-based character offset to start the selection at (default 0)
lengthNoNumber of characters to select (default: through the end of the value)
element_idYesText element to select in, from get_app_state
state_queryNoWith return_state, list only elements whose role, label or value contains this text, like get_app_state's query
return_stateNoAfter acting, wait for the app to finish reacting (up to 2 s) and append a fresh get_app_state of the app you last read, so you can check the result and pick the next target in the same call. Its ids replace every earlier id.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.7.1
    • changedInput schema / properties / return_state / description
      Previous value: -"After acting, wait briefly for the UI to settle and append a fresh get_app_state of the app you last read, so you can check the result and pick the next target in the same call. Its ids replace every earlier id."New value: +"After acting, wait for the app to finish reacting (up to 2 s) and append a fresh get_app_state of the app you last read, so you can check the result and pick the next target in the same call. Its ids replace every earlier id."
  2. Changed2 schema fields changedv0.5.2
    • addedInput schema / properties / return_state
      Added value: +{
      +  "description": "After acting, wait briefly for the UI to settle and append a fresh get_app_state of the app you last read, so you can check the result and pick the next target in the same call. Its ids replace every earlier id.",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / state_query
      Added value: +{
      +  "description": "With return_state, list only elements whose role, label or value contains this text, like get_app_state's query",
      +  "type": "string"
      +}
  3. Changed3 schema fields changedv0.3.1
    • addedInput schema / properties / element_id / description
      Added value: +"Text element to select in, from get_app_state"
    • changedInput schema / properties / length / description
      Previous value: -"Characters to select (default: to end)"New value: +"Number of characters to select (default: through the end of the value)"
    • changedInput schema / properties / start / description
      Previous value: -"Start offset (default 0)"New value: +"Zero-based character offset to start the selection at (default 0)"
  4. First observedv0.3.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare idempotentHint=true, destructiveHint=false and readOnlyHint=false. The description earns credit by resolving the tension that readOnlyHint=false creates: it clarifies that only the selection changes and the underlying text is not modified, which is the key behavioral fact an agent needs. It does not discuss permissions or error cases, so it stops short of 5.

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?

Three short sentences, front-loaded with the action and scope, then the sibling alternative, then the side-effect disclaimer. No filler and nothing redundant between sentences.

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 5-parameter tool with full schema coverage and no output schema, the description covers purpose, default range, side effect, and sibling routing. It does not explain what the return_state snapshot will look like, but the schema already describes that, leaving only minor gaps.

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 every parameter (including start/length defaults and the return_state mechanics) is already documented in the schema. The description only restates the start-to-end default, adding no syntax or semantics beyond that. Baseline 3 applies.

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 states a specific verb (select) and resource (a character range inside a text element), plus the mechanism (accessibility API). It explicitly separates itself from the adjacent siblings type_text and set_value, so an agent can route without opening any 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?

Gives both a positive use case (copy part of a value, or set up a partial replacement via type_text) and the explicit alternative plus its selection condition ('Use set_value to replace the whole value instead'). Default behavior (start -> end) is stated so the agent knows how to call it minimally.

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