Skip to main content
Glama

phone_elements

Read-only

Reads the current iPhone screen as structured text instead of screenshots, with row metadata and snapshot tokens for tapping elements. Use queries, limits, and selectors to narrow results.

Instructions

The current screen as text — use instead of screenshots. Rows carry kind, label, identifier, value, rect, state and a snapshot token for phone_tap_element, valid for this read only. query/limit/selector narrow rows but keep their indexes. Max 200 rows / 32 KiB; an omission notice means a partial view. registry lists saved flows for a newly entered app: prefer phone_flow_run. alert = a system alert is up: use an alert step, taps on alerts do not act. OCR rows: phone_tap their x/y.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "phone_elements"
  }
}

Input Schema

NameRequiredDescriptionDefault
ocrNoText read from a fresh screenshot (Vision OCR) for screens the tree cannot describe (games, canvases, video): `auto` adds it only when the tree has no interactive rows, `force` always, `off` (default) never.
limitNoReturn at most this many rows; the answer says how many were left out.
queryNoKeep only rows whose label, identifier, value or placeholder contains this text (case-insensitive). Rows keep their original index.
instanceNodaemon instance name
selectorNoLiteral case-sensitive field filters combined with AND; preserves original snapshot indexes. Requires literal criteria; optional index0..199 chooses one match in scoped/query tree order before limit. Row index remains the full snapshot index; incomplete or unknown earlier matches refuse an unproven rank. Filters AX elements, not separate OCR text.
include_hiddenNoShow off-screen/not-drawn rows individually in the text, with their original indexes and hidden state, instead of a five-label summary. The 200-row / 32 KiB text budget still applies. Scroll them into view before acting. Default false.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.29.2
    • removedInput schema / description
      Removed value: -"Parameters for [`phone_elements`]."
  2. Changed21 schema fields changedv0.29.0
    • removedInput schema / $defs / ElementSelector / additionalProperties
      Removed value: -false
    • changedInput schema / $defs / ElementSelector / description
      Previous value: -"A literal filter over exposed snapshot metadata.\n\n```\nlet selector: core::element_selector::ElementSelector =\n    serde_json::from_str(r#\"{\"value_present\": true}\"#).unwrap();\nlet row = serde_json::from_str(r#\"{\"kind\":\"TextField\",\"value\":\"\"}\"#).unwrap();\nassert!(selector.validate().is_ok());\nassert!(selector.matches(&row));\n```"New value: +"A literal filter over exposed snapshot metadata."
    • changedInput schema / $defs / ElementSelector / properties / enabled / type
      Previous value: -[
      -  "boolean",
      -  "null"
      -]New value: +"boolean"
    • changedInput schema / $defs / ElementSelector / properties / identifier / type
      Previous value: -[
      -  "string",
      -  "null"
      -]New value: +"string"
    • changedInput schema / $defs / ElementSelector / properties / kind / type
      Previous value: -[
      -  "string",
      -  "null"
      -]New value: +"string"
    • changedInput schema / $defs / ElementSelector / properties / label / type
      Previous value: -[
      -  "string",
      -  "null"
      -]New value: +"string"
    • changedInput schema / $defs / ElementSelector / properties / label_contains / type
      Previous value: -[
      -  "string",
      -  "null"
      -]New value: +"string"
    • changedInput schema / $defs / ElementSelector / properties / name / type
      Previous value: -[
      -  "string",
      -  "null"
      -]New value: +"string"
    • changedInput schema / $defs / ElementSelector / properties / value / type
      Previous value: -[
      -  "string",
      -  "null"
      -]New value: +"string"
    • changedInput schema / $defs / ElementSelector / properties / value_present / type
      Previous value: -[
      -  "boolean",
      -  "null"
      -]New value: +"boolean"
    • removedInput schema / additionalProperties
      Removed value: -false
    • changedInput schema / properties / instance / description
      Previous value: -"Installed local instance name, such as i13 or default. Omit to use the configured daemon. No fallback on failure."New value: +"daemon instance name"
    • removedInput schema / properties / limit / default
      Removed value: -null
    • changedInput schema / properties / limit / type
      Previous value: -[
      -  "integer",
      -  "null"
      -]New value: +"integer"
    • removedInput schema / properties / ocr / default
      Removed value: -null
    • changedInput schema / properties / ocr / type
      Previous value: -[
      -  "string",
      -  "null"
      -]New value: +"string"
    • removedInput schema / properties / query / default
      Removed value: -null
    • changedInput schema / properties / query / type
      Previous value: -[
      -  "string",
      -  "null"
      -]New value: +"string"
    • addedInput schema / properties / selector / $ref
      Added value: +"#/$defs/ElementSelector"
    • removedInput schema / properties / selector / anyOf
      Removed value: -[
      -  {
      -    "$ref": "#/$defs/ElementSelector"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedInput schema / properties / selector / default
      Removed value: -null
  3. Changed8 schema fields changedv0.27.34
    • addedInput schema / $defs / ElementSelector / description
      Added value: +"A literal filter over exposed snapshot metadata.\n\n```\nlet selector: core::element_selector::ElementSelector =\n    serde_json::from_str(r#\"{\"value_present\": true}\"#).unwrap();\nlet row = serde_json::from_str(r#\"{\"kind\":\"TextField\",\"value\":\"\"}\"#).unwrap();\nassert!(selector.validate().is_ok());\nassert!(selector.matches(&row));\n```"
    • addedInput schema / $defs / ElementSelector / properties / index
      Added value: +{
      +  "$ref": "#/$defs/MatchOrdinal",
      +  "description": "Zero-based ordinal among matching AX rows, 0..199; not a snapshot row index.\nRequires other criteria and a proven tree-order rank."
      +}
    • addedInput schema / $defs / ElementSelector / properties / name
      Added value: +{
      +  "description": "Exact name: non-empty identifier when present, otherwise label; case-sensitive.",
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
    • changedInput schema / $defs / ElementSelector / properties / value / description
      Previous value: -"Exact exposed accessibility value; known truncated previews never match.\nAn empty string matches a present empty value."New value: +"Exact exposed accessibility value; truncated, unavailable and secure values are unknown, never matches.\nAn empty string matches a present empty value."
    • addedInput schema / $defs / ElementSelector / properties / value_present
      Added value: +{
      +  "description": "Whether the snapshot supplies a string value, including empty or truncated\nstrings. False matches an omitted/null non-secure snapshot value, not an App's\nnull AX value. Protected SecureTextField rows match neither boolean.",
      +  "type": [
      +    "boolean",
      +    "null"
      +  ]
      +}
    • addedInput schema / $defs / MatchOrdinal
      Added value: +{
      +  "description": "Zero-based ordinal among matches, never a returned snapshot row index.",
      +  "maximum": 199,
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • addedInput schema / properties / limit / minimum
      Added value: +0
    • changedInput schema / properties / selector / description
      Previous value: -"Literal case-sensitive field filters combined with AND; preserves original snapshot indexes.\nRequires at least one field; filters AX elements, not separate OCR text."New value: +"Literal case-sensitive field filters combined with AND; preserves original snapshot indexes.\nRequires literal criteria; optional index0..199 chooses one match in scoped/query tree order before limit.\nRow index remains the full snapshot index; incomplete or unknown earlier matches refuse an unproven rank.\nFilters AX elements, not separate OCR text."
  4. Changed2 schema fields changedv0.27.21
    • addedInput schema / $defs
      Added value: +{
      +  "ElementSelector": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "enabled": {
      +        "description": "Exact enabled state. A missing state never matches either boolean.",
      +        "type": [
      +          "boolean",
      +          "null"
      +        ]
      +      },
      +      "identifier": {
      +        "description": "Exact accessibility identifier; case-sensitive.",
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      },
      +      "kind": {
      +        "description": "Exact accessibility kind, e.g. Button (XCUIElementTypeButton also accepted).",
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      },
      +      "label": {
      +        "description": "Exact label, preserving case, whitespace and newlines.",
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      },
      +      "label_contains": {
      +        "description": "Case-sensitive substring of the label. Combined with other fields using AND.",
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      },
      +      "value": {
      +        "description": "Exact exposed accessibility value; known truncated previews never match.\nAn empty string matches a present empty value.",
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      }
      +    },
      +    "type": "object"
      +  }
      +}
    • addedInput schema / properties / selector
      Added value: +{
      +  "anyOf": [
      +    {
      +      "$ref": "#/$defs/ElementSelector"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Literal case-sensitive field filters combined with AND; preserves original snapshot indexes.\nRequires at least one field; filters AX elements, not separate OCR text."
      +}
  5. Changed1 schema field changedv0.27.3
    • addedInput schema / properties / instance
      Added value: +{
      +  "description": "Installed local instance name, such as i13 or default. Omit to use the configured daemon. No fallback on failure.",
      +  "type": "string"
      +}
  6. First observedv0.21.0

TDQS

A4.9/5.0
Behavior5/5

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

Annotations only declare readOnlyHint and openWorldHint; the description adds the operational traits that matter — the `snapshot` token is valid for this read only, an omission notice signals a partial view, and a 200-row / 32 KiB budget applies. It also discloses a non-obvious behavioral quirk (taps on alerts do not act), which no annotation conveys.

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?

Front-loaded with the one-line purpose, then a dense sequence of operational facts with no filler — every sentence carries either a capability, a limit, or a routing rule. The terse fragment style is appropriate for a tool an agent will read repeatedly.

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?

Covers the full surface of a 6-parameter read tool: output row shape, snapshot staleness, budget/truncation behavior, the two special row kinds (registry, alert), and the OCR fallback path. With no output schema, this description supplies everything an agent needs to interpret the result and act on it.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3; the description earns an extra point by adding the global 200-row / 32 KiB cap that the `limit` schema field does not state, plus the consequence that query/selector narrow rows while preserving original indexes. It stops short of adding selector syntax detail, which the schema already covers.

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 first clause names a specific verb and resource — read the current screen as text — and immediately frames it against the obvious alternative ('use instead of screenshots'). It also names the row fields returned and the downstream sibling phone_tap_element, so an agent can tell this apart from phone_screen without opening either 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 explicit routing rules for several branches: screenshots are the wrong choice here, `registry` rows should route to phone_flow_run, `alert` rows should use an `alert` step rather than a tap, and OCR rows should be tapped by x/y. When-not guidance is present (taps on alerts do not act), leaving little to inference.

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