Skip to main content
Glama

Press a key or shortcut

ui_press_key

Send keyboard shortcuts or named keys to a background macOS app, triggering menu commands or posting input without bringing the app to the front. Set front mode only if the app ignores background input.

Instructions

Send a keyboard shortcut to an app in the background: a shortcut with command, control or option that belongs to a menu item presses that item (a hidden app ignores posted shortcuts); other keys are posted to the app's process. Pass front: true if an app ignores it. E.g. key "e" with ["command"], key "b" for the Blade tool, or named keys: return, enter, tab, space, delete, escape, left, right, up, down, home, end, pageup, pagedown, f1–f12.

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": {
      "app": "<app>",
      "key": "<key>"
    },
    "name": "ui_press_key"
  }
}

Input Schema

NameRequiredDescriptionDefault
appYesApp to control: finalcut, motion, logic, mainstage, compressor, pixelmator, keynote, pages, numbers, or any other app name, bundle ID or .app path
keyYes
frontNoBring the app to the front first. Off by default: apps are driven in the background so the user's screen isn't taken over.
modifiersNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.7.1

TDQS

A3.7/5.0
Behavior4/5

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

Annotations only declare readOnly=false, destructive=false, openWorld=false; the description adds the non-obvious mechanics — menu-bound modifier shortcuts actuate menu items, other keys are posted to the process, and hidden apps silently drop posted shortcuts. That last caveat is a real behavioral disclosure an agent could not infer from structured fields. It does not describe failure reporting or return behavior, keeping 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?

Front-loaded with the core behavior, then edge cases, then examples — a sensible ordering. The long parenthetical about hidden apps is slightly dense and the f1–f12 enumeration is lengthy, but both carry actionable information rather than filler.

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 4-parameter, no-output-schema tool with sparse annotations, the description covers dispatch semantics, the background-vs-front tradeoff, and key syntax. The remaining gap is what the agent should expect on failure (e.g., when a shortcut targets no menu item) and the meaning of the shift modifier.

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 coverage is 50%: app and front are documented, key and modifiers are not. The description compensates well for 'key' by giving concrete examples ('e' with command, 'b' for the Blade tool) and a full named-key list, but 'modifiers' is only obliquely referenced through 'command, control or option' and its enum values are never explained. Net value above the schema, but not full coverage.

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?

Opens with a specific verb+resource ('Send a keyboard shortcut to an app in the background') and immediately explains the two dispatch mechanisms (menu-item shortcut vs posted to process), which distinguishes it from ui_type_text and ui_click_menu in substance. It stops short of naming a sibling, so the differentiation is conceptual rather than explicit.

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?

Gives one conditional rule of thumb ('Pass front: true if an app ignores it') and notes that hidden apps ignore posted shortcuts, which is genuine when-to-use guidance. It never says when to prefer this over ui_type_text for literal text entry or ui_click_menu for menu selection, leaving the main routing decision implicit.

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