Skip to main content
Glama

browser_press_key

Sends a native key or chord to the current focus in an existing browser tab, optionally guarding focus with a ref or selector before dispatch and reporting the trusted keydown target.

Instructions

Send a native key/chord to current focus and report its trusted keydown target. Optional ref/selector guards focus without focusing it; a mismatch before dispatch sends no key. Supports F1–F12, navigation/editing keys and US ASCII punctuation.

Input Schema

NameRequiredDescriptionDefault
keyYes
nthNoSelector only: zero-based DOM index, AX tree order for role.
refNo
nameNorole only: exact AX name; empty allowed.
frameNoChild frame: at least one of url/title/path. url/title exact; path=unique nested CSS iframe steps (e.g. ["#frame"]); exclusive with frame_id.
observeNoRead this explicit control after the action within its remaining budget; observation is separate from delivery. No assertion or automatic replay.
frame_idNoSelector frame; default main.
selectorNoQuery by selector_type; role example: selector="link", name="Claim".
tab_handleYes
timeout_msNoTotal preparation/dispatch/verification and optional observation budget.
dialog_policyNoaccept/dismiss auto-handle dialogs and return their messages.ask
selector_typeNoDefault css. label: exact associated HTML label, whitespace normalized. placeholder: exact attribute.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed9 schema fields changedv0.28.2
    • addedInput schema / properties / frame
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Child frame: at least one of url/title/path. url/title exact; path=unique nested CSS iframe steps (e.g. [\"#frame\"]); exclusive with frame_id.",
      +  "properties": {
      +    "path": {
      +      "items": {
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "maxItems": 16,
      +      "minItems": 1,
      +      "type": "array"
      +    },
      +    "title": {
      +      "minLength": 1,
      +      "type": "string"
      +    },
      +    "url": {
      +      "minLength": 1,
      +      "type": "string"
      +    }
      +  },
      +  "type": "object"
      +}
    • addedInput schema / properties / frame_id
      Added value: +{
      +  "description": "Selector frame; default main.",
      +  "type": "string"
      +}
    • addedInput schema / properties / name
      Added value: +{
      +  "description": "role only: exact AX name; empty allowed.",
      +  "maxLength": 10000,
      +  "type": "string"
      +}
    • addedInput schema / properties / nth
      Added value: +{
      +  "description": "Selector only: zero-based DOM index, AX tree order for role.",
      +  "maximum": 9007199254740991,
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • addedInput schema / properties / observe
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Read this explicit control after the action within its remaining budget; observation is separate from delivery. No assertion or automatic replay.",
      +  "properties": {
      +    "frame": {
      +      "additionalProperties": false,
      +      "description": "Child frame: at least one of url/title/path. url/title exact; path=unique nested CSS iframe steps (e.g. [\"#frame\"]); exclusive with frame_id.",
      +      "properties": {
      +        "path": {
      +          "items": {
      +            "minLength": 1,
      +            "type": "string"
      +          },
      +          "maxItems": 16,
      +          "minItems": 1,
      +          "type": "array"
      +        },
      +        "title": {
      +          "minLength": 1,
      +          "type": "string"
      +        },
      +        "url": {
      +          "minLength": 1,
      +          "type": "string"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "frame_id": {
      +      "description": "Selector frame; default main.",
      +      "type": "string"
      +    },
      +    "max_chars": {
      +      "default": 16000,
      +      "maximum": 64000,
      +      "minimum": 1000,
      +      "type": "integer"
      +    },
      +    "max_options": {
      +      "default": 30,
      +      "maximum": 100,
      +      "minimum": 1,
      +      "type": "integer"
      +    },
      +    "name": {
      +      "description": "role only: exact AX name; empty allowed.",
      +      "maxLength": 10000,
      +      "type": "string"
      +    },
      +    "nth": {
      +      "description": "Selector only: zero-based DOM index, AX tree order for role.",
      +      "maximum": 9007199254740991,
      +      "minimum": 0,
      +      "type": "integer"
      +    },
      +    "popup_selector": {
      +      "description": "Optional unique CSS popup in the control frame; otherwise use browser-resolved controls/owns relations and control descendants.",
      +      "maxLength": 10000,
      +      "minLength": 1,
      +      "type": "string"
      +    },
      +    "ref": {
      +      "type": "string"
      +    },
      +    "selector": {
      +      "description": "Query by selector_type; role example: selector=\"link\", name=\"Claim\".",
      +      "maxLength": 10000,
      +      "minLength": 1,
      +      "type": "string"
      +    },
      +    "selector_type": {
      +      "description": "Default css. label: exact associated HTML label, whitespace normalized. placeholder: exact attribute.",
      +      "enum": [
      +        "css",
      +        "xpath",
      +        "label",
      +        "placeholder",
      +        "role"
      +      ],
      +      "type": "string"
      +    },
      +    "timeout_ms": {
      +      "default": 1000,
      +      "maximum": 5000,
      +      "minimum": 100,
      +      "type": "integer"
      +    }
      +  },
      +  "type": "object"
      +}
    • addedInput schema / properties / ref
      Added value: +{
      +  "type": "string"
      +}
    • addedInput schema / properties / selector
      Added value: +{
      +  "description": "Query by selector_type; role example: selector=\"link\", name=\"Claim\".",
      +  "maxLength": 10000,
      +  "minLength": 1,
      +  "type": "string"
      +}
    • addedInput schema / properties / selector_type
      Added value: +{
      +  "description": "Default css. label: exact associated HTML label, whitespace normalized. placeholder: exact attribute.",
      +  "enum": [
      +    "css",
      +    "xpath",
      +    "label",
      +    "placeholder",
      +    "role"
      +  ],
      +  "type": "string"
      +}
    • changedInput schema / properties / timeout_ms / description
      Previous value: -"Total preparation/dispatch/verification budget."New value: +"Total preparation/dispatch/verification and optional observation budget."
  2. Changed2 schema fields changedv0.24.2
    • changedInput schema / properties / dialog_policy / description
      Previous value: -"accept/dismiss returns handled dialog messages."New value: +"accept/dismiss auto-handle dialogs and return their messages."
    • changedInput schema / properties / timeout_ms / description
      Previous value: -"Covers preparation, dispatch and verification."New value: +"Total preparation/dispatch/verification budget."
  3. First observedv0.24.0

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations, the description carries the full burden; it does disclose useful behavior — trusted native events, reporting the keydown target, and the fail-safe of sending no key on a pre-dispatch guard mismatch. However, it omits the chord syntax (how modifiers are expressed), what happens on failure (error vs silent), and how dialog_policy interacts with the dispatch.

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?

Three compact clauses with the core action front-loaded and the guard semantics second. Dense but every sentence contributes; only mild jargon ('trusted keydown target') costs a little clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 12-parameter tool with a nested observe object and no output schema, the description covers the primary key dispatch and guard behavior but says nothing about the observe block, timeout budget, or dialog handling. The return value is only loosely gestured at ('report its trusted keydown target').

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 75%, so the baseline is 3, but the description adds real value: the `key` parameter has no schema description, yet the text specifies supported ranges (F1–F12, navigation/editing keys, US ASCII punctuation), and it explains the semantics of the otherwise-undescribed ref/selector guard. The nested observe/timeout/dialog_policy parameters remain unaddressed.

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+resource: 'Send a native key/chord to current focus' and adds that it reports the trusted keydown target. This clearly separates it from text-entry siblings like browser_type/browser_fill, though it never names those alternatives explicitly.

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?

Usage is only implied: 'Optional ref/selector guards focus without focusing it; a mismatch before dispatch sends no key' explains how the guards behave but not when an agent should reach for this tool instead of browser_type or browser_click. There is no explicit when-to-use/when-not guidance.

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