Skip to main content
Glama

browser_press_key

Press keyboard keys such as Enter, Tab, Escape, or arrow keys to submit forms, navigate dropdowns, close dialogs, and send modifier-key shortcuts in a browser.

Instructions

Press a keyboard key (Enter, Tab, Escape, ArrowDown, etc.). Useful for submitting forms, navigating dropdowns, closing dialogs. Supports modifier keys (ctrl, alt, shift, meta). Enter acts like the real key (the page gets keydown, keypress and keyup 13): in a text field it submits the form, on a focused button it presses it, and in a textarea it adds a line break - from 1.33; before, it did none of these, so press Enter only when that is what you want. "Space" is the space bar: in a field it types a space, on a focused button it presses it, and on a checkbox it ticks it (from 1.33; before, it did none of these). Key codes follow the US layout: punctuation is sent as the key it sits on ("," is keyCode 188, code "Comma"), and a shifted character such as "<" or "@" is that key with Shift held; a capital letter is sent without Shift. shift does not change the character ("," with shift is still a comma). While ctrl, meta or alt is held, no character is typed. With ctrl or meta (and no shift), the letters a, c, x, v, z and y are sent with Chrome's own editing command - select all, copy, cut, paste, undo, redo; z with shift is redo - including on macOS, where Chrome runs no shortcut for a synthetic key without it. The answer names the command that was sent in shortcut; landed says the page received the key, not what the command did. Paste inserts the user's real clipboard into the page, and copy and cut replace what is on it.

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

Input Schema

NameRequiredDescriptionDefault
altNoHold Alt key
keyYesKey to press: "Enter", "Tab", "Escape", "ArrowDown", "ArrowUp", "Backspace", "a", "1", etc.
codeNoPhysical key code (optional). Without it, the key it sits on in the US layout: "KeyA" for "a", "Comma" for ",", "Digit2" for "@"; a character not on a US keyboard gets none. Setting it changes only the code, not the key code
ctrlNoHold Ctrl/Cmd key
metaNoHold Meta (Cmd on Mac) key
shiftNoHold Shift key
partitionNoRun this call in a partition from browser_partition (an id like "p1"). Leave it out for the default partition. An unknown or closed id is an error; the call is never sent to the default partition instead.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.33.0
    • changedInput schema / properties / code / description
      Previous value: -"Key code (optional, defaults to key name). E.g. \"KeyA\" for \"a\""New value: +"Physical key code (optional). Without it, the key it sits on in the US layout: \"KeyA\" for \"a\", \"Comma\" for \",\", \"Digit2\" for \"@\"; a character not on a US keyboard gets none. Setting it changes only the code, not the key code"
    • addedInput schema / properties / partition
      Added value: +{
      +  "description": "Run this call in a partition from browser_partition (an id like \"p1\"). Leave it out for the default partition. An unknown or closed id is an error; the call is never sent to the default partition instead.",
      +  "type": "string"
      +}
  2. First observedv1.0.0

TDQS

A4.4/5.0
Behavior5/5

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

With no annotations supplied, the description carries the full disclosure burden and does so thoroughly: it explains that Enter dispatches keydown/keypress/keyup 13, distinguishes behavior by focus context (text field submits, focused button presses, textarea inserts a newline), and does the same for Space. It further discloses modifier semantics (no character typed while ctrl/meta/alt held), the clipboard side effect of paste ('inserts the user's real clipboard into the page, and copy and cut replace what is on it'), and the meaning of the returned `shortcut` and `landed` fields, including that `landed` does not indicate what the command did.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose is front-loaded and no sentence is off-topic, but the body is a dense wall of text with repetition - the 'from 1.33; before, it did none of these' version history is stated twice and is irrelevant to invocation. Buried clauses like the Shift/character rule and the shortcut-key table would be clearer as a list rather than run-on prose.

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?

There is no output schema, yet the description still explains the two returned fields (`shortcut` and `landed`) and their limits, and it covers the partition/error behavior only lightly because the schema already documents it. For a tool with seven parameters and subtle modifier semantics, nothing an agent needs in order to call it correctly appears to be missing.

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

Parameters5/5

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

Schema coverage is 100%, so the baseline would be 3, but the description adds substantial meaning the schema does not: keys follow the US layout, punctuation is sent as the physical key (',' is keyCode 188 / code 'Comma'), shifted characters like '<' or '@' are that key with Shift held, a capital letter is sent without Shift, shift does not change the produced character, and ctrl/meta plus a,c,x,v,z,y map to Chrome editing commands (z+shift is redo, including on macOS). That materially changes how an agent should construct `key`, `code`, and the modifier booleans.

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?

The description opens with a specific verb and resource - 'Press a keyboard key' - and enumerates concrete examples (Enter, Tab, Escape, ArrowDown) plus likely use cases (submitting forms, navigating dropdowns, closing dialogs). It is instantly clear what the tool does, but it never names a sibling it is not (e.g. browser_fill for typing text, browser_select_option for dropdowns), so the agent must infer the boundary itself.

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?

It gives real when-to-use context ('submitting forms, navigating dropdowns, closing dialogs') and an explicit conditional warning to press Enter 'only when that is what you want', which is guidance against a plausible mistake. What is missing is routing to alternatives: nothing says to use browser_fill to enter text or browser_select_option to pick a dropdown item instead of arrowing through it.

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