Skip to main content
Glama
Browser Session MCP

Browser Session MCP

press_key

Destructive

Simulates keyboard input in the active browser tab, including key combinations and repeated presses; optionally focuses a selector first so agents can submit forms or navigate.

Instructions

Press a key via CDP keyboard input in the session's active tab. key is a name (Enter, Tab, Escape, Backspace, ArrowDown, Space, …), a single character, or a combination held down together such as Shift+Tab or Control+a (modifiers: Shift, Control, Alt, Meta). With a selector (CSS; or plain language — a jev: goal such as jev: the password field goes straight to the Jev decision model, and with TYPESAFE_API_KEY set a selector that matches nothing as CSS is retried as plain language), waits up to timeout for it and focuses it first (e.g. type into a field then press Enter); without, presses on whatever is focused, and timeout is unused. Use type for whole strings and click to activate buttons. Pressing Enter can submit a form, like a real user. Returns a confirmation. Fails on an unknown key name, or if the selector matches nothing within timeout and Jev can't (or isn't configured to) resolve 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": {
      "sessionId": "<sessionId>",
      "key": "<key>"
    },
    "name": "press_key"
  }
}

Input Schema

NameRequiredDescriptionDefault
keyYesKey name in the US layout (Enter, Tab, Escape, Backspace, ArrowDown, Space…), one character, or a combination such as Shift+Tab or Control+a.
repeatNoPress it this many times (at most 50), e.g. to walk focus with Tab; the result's `focusTrail` lists the focused element after each press. Default 1.
timeoutNoMilliseconds to wait for `selector` to appear. Default 5000.
selectorNoCSS selector of an element to focus before pressing. Or describe it in plain words (`jev:<goal>` goes straight to the Jev decision model; when TYPESAFE_API_KEY is set a selector that matches nothing as CSS is retried as such a description). Omit to press on the focused element.
sessionIdYesThe id returned by open_browser_session. Errors if no open session has it.

Output Schema

NameRequiredDescriptionDefault
hitNoWhat was at the clicked or tapped point.
urlYesThe page's URL after the action.
titleYesThe page's title after the action.
dialogNoAn open dialog's text, if one is showing.
changedNoA field `type` filled that the page changed once focus left it (a date that reformats or reverts on blur), with both texts.
focusedYesThe element with keyboard focus, or "nothing".
optionsNoThe options of a dropdown or list open after the action (the one the focused field controls, else any showing), up to 50: pick one with select_option or click.
answeredNoThe page's own dialogs (alert, confirm, prompt, "Leave site?") answered since the last action, each accepted.
rejectedNoFields the page rejected during the action, each with its message: the browser's own form check (a required field left empty), or the page marking them invalid. The form wasn't sent while any remain.
navigatedYesWhether the URL changed.
focusTrailNoWith press_key's `repeat`: the focused element after each press.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.1.23
    • addedInput schema / properties / repeat
      Added value: +{
      +  "description": "Press it this many times (at most 50), e.g. to walk focus with Tab; the result's `focusTrail` lists the focused element after each press. Default 1.",
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "https://json-schema.org/draft/2020-12/schema",
      +  "properties": {
      +    "answered": {
      +      "description": "The page's own dialogs (alert, confirm, prompt, \"Leave site?\")\nanswered since the last action, each accepted.",
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    "changed": {
      +      "description": "A field `type` filled that the page changed once focus left it (a\ndate that reformats or reverts on blur), with both texts.",
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "dialog": {
      +      "description": "An open dialog's text, if one is showing.",
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "focusTrail": {
      +      "description": "With press_key's `repeat`: the focused element after each press.",
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": [
      +        "array",
      +        "null"
      +      ]
      +    },
      +    "focused": {
      +      "description": "The element with keyboard focus, or \"nothing\".",
      +      "type": "string"
      +    },
      +    "hit": {
      +      "description": "What was at the clicked or tapped point.",
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "navigated": {
      +      "description": "Whether the URL changed.",
      +      "type": "boolean"
      +    },
      +    "options": {
      +      "description": "The options of a dropdown or list open after the action (the one the\nfocused field controls, else any showing), up to 50: pick one with\nselect_option or click.",
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": [
      +        "array",
      +        "null"
      +      ]
      +    },
      +    "rejected": {
      +      "description": "Fields the page rejected during the action, each with its message:\nthe browser's own form check (a required field left empty), or the\npage marking them invalid. The form wasn't sent while any remain.",
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    "title": {
      +      "description": "The page's title after the action.",
      +      "type": "string"
      +    },
      +    "url": {
      +      "description": "The page's URL after the action.",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "url",
      +    "title",
      +    "navigated",
      +    "focused"
      +  ],
      +  "type": "object"
      +}
  2. Changed1 schema field changedv0.1.18
    • changedInput schema / properties / key / description
      Previous value: -"Key name in the US layout (Enter, Tab, Escape, Backspace, ArrowDown…) or one character."New value: +"Key name in the US layout (Enter, Tab, Escape, Backspace, ArrowDown, Space…), one character, or a combination such as Shift+Tab or Control+a."
  3. Changed1 schema field changedv0.1.14
    • changedInput schema / properties / selector / description
      Previous value: -"CSS selector of an element to focus before pressing. Omit to press on the focused element."New value: +"CSS selector of an element to focus before pressing. Or describe it in plain words (`jev:<goal>` goes straight to the Jev decision model; when TYPESAFE_API_KEY is set a selector that matches nothing as CSS is retried as such a description). Omit to press on the focused element."
  4. Changed4 schema fields changed
    • addedInput schema / properties / key / description
      Added value: +"Key name in the US layout (Enter, Tab, Escape, Backspace, ArrowDown…) or one character."
    • addedInput schema / properties / selector / description
      Added value: +"CSS selector of an element to focus before pressing. Omit to press on the focused element."
    • addedInput schema / properties / sessionId / description
      Added value: +"The id returned by open_browser_session. Errors if no open session has it."
    • addedInput schema / properties / timeout / description
      Added value: +"Milliseconds to wait for `selector` to appear. Default 5000."
  5. First observedv0.1.2

TDQS

A4.6/5.0
Behavior4/5

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

Goes well beyond the annotations by disclosing the real risk behind destructiveHint: 'Pressing Enter can submit a form, like a real user.' It also names the failure modes (unknown key name, selector never matching and Jev unable/unconfigured to resolve) and states a confirmation is returned. Slightly short of 5 only because it doesn't describe what the confirmation/focusTrail payload contains, though an output schema exists.

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 action and alternatives, and nothing is truly wasted. It loses a point for dense nested parentheticals (the Jev/TYPESAFE_API_KEY aside inside the selector clause) that make it harder to scan than it needs to be.

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?

For a non-idempotent, destructive-capable input tool with an output schema, this covers prerequisites (sessionId from open_browser_session), the side-effect risk, failure conditions, and the return shape at a high level. An agent has everything needed to call it correctly and predict consequences.

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 already 100%, so the baseline is 3; the description adds genuine meaning on top — the modifier combination syntax (Shift+Tab, Control+a), the `jev:` plain-language selector route with TYPESAFE_API_KEY fallback behavior, and that timeout applies only to selector resolution. That is real semantic value, not restatement.

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+resource ('Press a key via CDP keyboard input in the session's active tab') and immediately distinguishes itself from the two closest siblings by name ('Use type for whole strings and click to activate buttons'). An agent can pick this tool over click/type without opening a schema.

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?

Gives explicit when/when-not and alternatives: use type for whole strings, click to activate buttons, and use a selector to focus a field first (e.g. type then press Enter) versus omitting it to press on whatever is focused. It even notes the timeout is unused in the no-selector case.

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