Back to docs

Tool Press Key

Category: Browser Automation Β· Tier: Free

Press a keyboard key. Supports modifier combos like Control+a, Shift+Enter, Meta+c.

Parameters

Parameter Type Required Description
key string Yes Key to press (e.g., Enter, Tab, Escape, ArrowDown, Control+a, Meta+c)
force boolean No Press even when Enter or Space would activate a red-zone control
_browserToken string No Browser session token

On success the response is { "success": true, "pressed": "<key>" }.

Red-zone refusal

Enter or Space on a focused red-zone control (delete account, pay, checkout), or Enter in a field whose form submits one, is refused unless force is true. This is the same gate as click, type_text and the CLI's keyboard, and a refused key is written to the audit log. The response is a tool error (isError: true):

Field Value
success false
tool "press_key"
zone "red"
pressed null
target The control the key would have activated (tag, label)
message "Red zone action requires --force: ..." then "Re-run with force: true (the MCP tool parameter; --force is the CLI flag)."
howToRun "Re-run with force: true (the MCP tool parameter; --force is the CLI flag)."

On the hosted server a refused call is refunded, because nothing was pressed.

Common Keys

Key Description
Enter Submit form, confirm dialog
Tab Move to next field
Escape Close modal, cancel
ArrowDown / ArrowUp Navigate dropdowns, lists
Backspace Delete character
Control+a Select all
Control+c / Control+v Copy / paste
Meta+c / Meta+v Copy / paste (macOS)

Full key reference: MDN KeyboardEvent.key

From the Blog