Skip to main content
Glama

press_key

Send real keydown, keypress, and keyup events for Enter, Tab, Escape, arrows, or shortcuts to a focused or selected element so framework handlers fire. Use for navigation, not typing.

Instructions

Send a key to the focused element (or to selector, focusing it first) as a real keydown/keypress/keyup sequence, so framework handlers fire. For typing a value use type_text; this is for Enter, Tab, Escape, arrows and shortcuts. Not idempotent: two calls send the key twice. Returns page_changed like click; when the key opens or reveals something, the refs of the visible interactives follow.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
altNoHold Alt
keyYese.g. "Enter", "Escape", "Tab", "ArrowDown"
ctrlNoHold Control
metaNoHold Meta (Command/Windows)
shiftNoHold Shift
tab_idNoTarget tab; omitted = last tab navigated in this session, else the active one
trustedNoReal browser key (isTrusted) via chrome.debugger, main frame only
frame_idNoTarget iframe id from get_frames; omitted = main frame
selectorNoTarget (default: activeElement)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.28.0
    • addedInput schema / properties / trusted
      Added value: +{
      +  "default": false,
      +  "description": "Real browser key (isTrusted) via chrome.debugger, main frame only",
      +  "type": "boolean"
      +}
  2. Changed6 schema fields changedv1.10.0
    • addedInput schema / properties / alt / description
      Added value: +"Hold Alt"
    • addedInput schema / properties / ctrl / description
      Added value: +"Hold Control"
    • addedInput schema / properties / frame_id / description
      Added value: +"Target iframe id from get_frames; omitted = main frame"
    • addedInput schema / properties / meta / description
      Added value: +"Hold Meta (Command/Windows)"
    • addedInput schema / properties / shift / description
      Added value: +"Hold Shift"
    • addedInput schema / properties / tab_id / description
      Added value: +"Target tab; omitted = last tab navigated in this session, else the active one"
  3. First observedv1.8.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=false, idempotentHint=false, destructiveHint=false. The description adds value beyond this by stating it is NOT idempotent ('two calls send the key twice') and that it returns page_changed like click, plus mentions that refs of visible interactives follow when something opens. This is useful context beyond annotations, though return format details are lightly covered.

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?

Two sentences, front-loaded with the core behavior and usage guidance. Every part earns its place, including the non-idempotency note and return behavior. No wasted words.

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?

Given annotations covering safety profile and a 100%-covered schema, the description is nearly complete. It covers purpose, usage, non-idempotency, and return behavior. Minor gap: does not explain 'trusted' parameter behavior, but the schema covers that. Overall, an agent has what it needs to invoke 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 coverage is 100%, so parameters like alt, ctrl, meta, shift, tab_id, trusted, frame_id are documented in the schema. The description clarifies that the key targets the focused element by default or a selector, which maps to the selector parameter, but adds no new syntax or format beyond schema. Baseline 3 is appropriate when 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?

States a specific verb and resource ('Send a key to the focused element') and explains the mechanism (real keydown/keypress/keyup sequence). It differentiates from the sibling type_text by explicitly stating that typing a value should use type_text, and this is for Enter/Tab/Escape/arrows/shortcuts.

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?

Explicitly routes the agent: 'For typing a value use type_text; this is for Enter, Tab, Escape, arrows and shortcuts.' Names the alternative and the condition that selects it. Also notes it targets the focused element by default or a selector.

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