Skip to main content
Glama
MCP Appium

MCP Appium

Official
by appium

generate_locators

Read-only

Generate current-page locator candidates for UI element inspection, filtered by a literal query or custom XPath attributes across the active Appium session.

Instructions

Generate current-page locator candidates for inspection. Defaults: controls for UiAutomator2/XCUITest/Web; all elements except hierarchy for other native drivers.

Input Schema

NameRequiredDescriptionDefault
queryNoCase-insensitive literal substring of an element tag or attribute value (name, label, text, ID, etc.). Searches all element types, including hidden elements. Blank or omitted keeps the default driver-specific filter.
sessionIdNoSession ID; defaults to the active session.
xpathAttributesNoAdditional XPath attribute names in priority order, e.g. AutomationId or data-testid. Tried before built-in attributes; defaults remain as fallback. No namespace prefixes or XPath expressions.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.99.1
    • addedInput schema / properties / query
      Added value: +{
      +  "description": "Case-insensitive literal substring of an element tag or attribute value (name, label, text, ID, etc.). Searches all element types, including hidden elements. Blank or omitted keeps the default driver-specific filter.",
      +  "type": "string"
      +}
    • addedInput schema / properties / xpathAttributes
      Added value: +{
      +  "description": "Additional XPath attribute names in priority order, e.g. AutomationId or data-testid. Tried before built-in attributes; defaults remain as fallback. No namespace prefixes or XPath expressions.",
      +  "items": {
      +    "pattern": "^[A-Za-z_][A-Za-z0-9_.-]*$",
      +    "type": "string"
      +  },
      +  "maxItems": 20,
      +  "type": "array"
      +}
  2. Changed1 schema field changedv1.95.0
    • changedInput schema / properties / sessionId / description
      Previous value: -"Session ID to target. If omitted, uses the active session."New value: +"Session ID; defaults to the active session."
  3. First observedv1.92.11

TDQS

A3.6/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, so safety is covered, and the description still adds real value: it discloses the driver-specific default element filters (controls for UiAutomator2/XCUITest/Web, everything except hierarchy elsewhere), which materially changes what results come back. It does not say how many candidates are returned or in what form, which keeps it below a 5.

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?

Two front-loaded sentences with no filler; purpose comes first and the driver-specific defaults second. The phrasing is dense to the point of being terse ('hierarchy' is unexplained), but nothing is wasted.

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

Completeness3/5

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

For a zero-required-param, read-only inspection tool with full schema coverage this is close to adequate: purpose, scope and default filtering are all present. With no output schema, however, the description should say what a 'locator candidate' looks like (XPath, accessibility id, attribute set) and whether results are capped, since an agent cannot otherwise plan around the response.

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% and each parameter is well documented in the schema, so the baseline is 3. The description's defaults sentence overlaps with what the query param description already says about the blank/omitted case, so it adds little parameter meaning beyond the schema.

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 and resource: generate locator candidates for the current page for inspection. That is concrete and distinguishable in spirit from appium_find_element/appium_get_page_source, but the description never names those siblings, so the agent must infer whether it wants a locator list or an element handle. Adding one clause on how this differs from the find_* tools would make it a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

'for inspection' implies the tool is a discovery step rather than an action, and the driver-defaults sentence implies it is the quick way to see what is locatable. There is no explicit when-to-use vs appium_find_element/appium_find_elements, no prerequisite (does a session need to be active?), and no exclusion. Usage is inferable but not stated.

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