Skip to main content
Glama

get_text

Reads the visible text a user sees on a web element, waiting until it becomes visible and returning trimmed text. Target it by selector or ref from capture_page.

Instructions

Read the visible text of an element: what a user sees, not hidden text or an input's value. Waits for the element to be visible, then returns its text (trimmed by default). Target it by selector or by a ref from capture_page. To read an input's value or any attribute, use get_attribute; to check text as a pass/fail test step, use assert_text.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
refNoElement ref from the latest capture_page result (e.g. 'e12'). Use instead of selector; refs go stale after navigation, so capture again if one is rejected.
trimNoRemove leading and trailing whitespace (default true).
selectorNoHow to find the element, e.g. { by: 'id', value: 'user-name' } or { by: 'css', value: '#login-button' }. Provide either selector or ref.
timeoutMsNoHow long to wait for the element to become visible, in milliseconds (default 10000).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv0.3.0
    • addedInput schema / properties / ref / description
      Added value: +"Element ref from the latest capture_page result (e.g. 'e12'). Use instead of selector; refs go stale after navigation, so capture again if one is rejected."
    • addedInput schema / properties / selector / description
      Added value: +"How to find the element, e.g. { by: 'id', value: 'user-name' } or { by: 'css', value: '#login-button' }. Provide either selector or ref."
    • addedInput schema / properties / selector / properties / by / description
      Added value: +"Locator strategy: css, xpath, id, name, class/className, tag/tagName, linkText, or partialLinkText."
    • addedInput schema / properties / selector / properties / value / description
      Added value: +"The locator for that strategy, e.g. '#login-button' for css, 'user-name' for id, or //button[@type=\"submit\"] for xpath."
    • addedInput schema / properties / timeoutMs / description
      Added value: +"How long to wait for the element to become visible, in milliseconds (default 10000)."
    • addedInput schema / properties / trim / description
      Added value: +"Remove leading and trailing whitespace (default true)."
  2. Changed2 schema fields changedv0.2.0
    • addedInput schema / properties / ref
      Added value: +{
      +  "minLength": 1,
      +  "type": "string"
      +}
    • removedInput schema / required
      Removed value: -[
      -  "selector"
      -]
  3. First observedv0.1.2

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 behavioral burden and does so well for a read tool: it discloses that it waits for the element to become visible before returning, that it excludes hidden text, and that output is trimmed by default. It does not mention the timeout ceiling or pagination-style edge cases (e.g. what happens if the element never becomes visible), which the schema's timeoutMs only partially covers.

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 front-loaded sentences with zero waste: purpose, then visible-text qualifier, then targeting and sibling routing. Every clause earns its place and the most important constraint (visible, not hidden/value) comes first.

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

Completeness5/5

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

No output schema exists, and the description compensates by stating that it returns the element's text, trimmed by default. Combined with the visibility-wait behavior, cursor-targeting guidance, and sibling routing, an agent has everything needed to call it correctly.

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 four parameters are already fully documented in the schema. The description reinforces ref-vs-selector targeting and the trimmed-by-default behavior but adds no syntax or format detail beyond what the schema provides. Baseline 3 is appropriate when the schema does the heavy lifting.

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 precise verb+resource ('Read the visible text of an element') and immediately scopes it with the key qualifier 'what a user sees, not hidden text or an input's value.' It explicitly contrasts itself with get_attribute and assert_text, so an agent can distinguish it from siblings 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?

It names both alternatives and the exact condition that selects each: get_attribute for input values or attributes, assert_text for pass/fail text assertions. It also tells the agent how to target the element (selector or a ref from capture_page), leaving nothing to inference.

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