Skip to main content
Glama

mac_find_ui

Retrieve UI element details (role, title, position, size) from macOS apps via Accessibility, with an optional Electron CDP fallback for apps with shallow accessibility trees.

Instructions

Find UI elements (role, title, position, size) in an app via Accessibility, with optional Electron CDP fallback.

Examples:

  • All buttons in Safari: { app: "Safari", role: "AXButton" }

  • Element by title: { app: "Mail", title: "Send" }

  • Fuzzy search: { app: "Finder", searchText: "Documents" }

  • Electron AX (VSCode with --remote-debugging-port=9222): { app: "Visual Studio Code", useElectronFallback: true }

  • Auto-fallback for known Electron apps: { app: "Cursor", useElectronFallback: "auto" }

Limitations:

  • Requires Accessibility permission for the client app.

  • Electron apps (VSCode, Cursor, Slack, Discord) expose a thin AX tree; use useElectronFallback when AX returns empty.

  • CDP fallback needs the user to relaunch the app with --remote-debugging-port=.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
appYesApplication name
roleNoAX role filter (e.g., AXButton, AXTextField)
titleNoExact element title to search for
maxResultsNoMax results (1-50, default: 10)
searchTextNoFuzzy text search across all visible elements
electronCdpPortNoExplicit CDP port (skips auto-detect). Range 1-65535.
useElectronFallbackNoUse Chrome DevTools Protocol fallback for Electron apps. `true` = always try; `"auto"` = only for known Electron apps when AX returns empty.
Behavior4/5

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

With no annotations, the description carries the full burden. It discloses required permissions ('Requires Accessibility permission for the client app'), the behavior for Electron apps ('expose a thin AX tree'), and the prerequisite for CDP fallback ('needs the user to relaunch the app with --remote-debugging-port=<PORT>'). These are valuable behavioral traits beyond the schema. It does not detail return structure or error handling, which is a minor gap.

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?

The description is well-structured: a one-sentence summary, five illustrative examples, and three bullet-point limitations. Every sentence contributes information about usage or constraints. There is no fluff or repetition, and the front-loaded summary quickly establishes the tool's purpose.

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 tool with 7 parameters and no output schema, the description covers purpose, usage examples, and key limitations. It implies the return contains role, title, position, and size but does not explicitly state the return format (array, JSON). Error behavior for missing permissions or app not running is also absent. Given the complexity, this is a solid but not perfect level of completeness.

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 adds value through examples that illustrate parameter combinations (e.g., { app: 'Cursor', useElectronFallback: 'auto' }) and clarifies when to use 'auto' vs boolean for useElectronFallback. This goes beyond the schema's descriptions by showing practical usage patterns.

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 opens with a clear verb and resource: 'Find UI elements (role, title, position, size) in an app via Accessibility.' This distinguishes it from sibling tools like mac_run (execute commands) and mac_state (inspect state). It also mentions the optional Electron CDP fallback, further specifying scope.

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?

The description provides concrete examples for different use cases (all buttons, exact title, fuzzy search, Electron fallback) and notes a key limitation: 'use useElectronFallback when AX returns empty.' It gives clear context on when to use the tool, though it does not explicitly name alternatives or exclusions. The examples and limitations serve as implicit guidance.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/leesgit/mac-pilot-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server