Skip to main content
Glama

browser_press_key

Sends native keys or key chords to the focused browser element and reports the trusted keydown target, with optional ref or selector guards that block dispatch on focus mismatch.

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.

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

Input Schema

NameRequiredDescriptionDefault
keyYes
nthNoZero-based match index.
refNo
nameNoExact AX name; role only.
frameNoChild frame; see shared locator rules.
observeNoPost-action control read or snapshot diff; see shared observation rules.
frame_idNoSelector frame; default main.
selectorNoLocator query.
wait_forNoPost-action checks (same conditions as wait); shares the total action budget. Result is wait_result, never input replay.
tab_handleYes
timeout_msNoTotal action, wait and observation budget.
dialog_policyNoask
selector_typeNoDefault css.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed13 schema fields changedv0.34.0
    • removedInput schema / properties / dialog_policy / description
      Removed value: -"accept/dismiss auto-handle dialogs and return their messages."
    • changedInput schema / properties / frame / description
      Previous value: -"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."New value: +"Child frame; see shared locator rules."
    • changedInput schema / properties / name / description
      Previous value: -"role only: exact AX name; empty allowed."New value: +"Exact AX name; role only."
    • changedInput schema / properties / nth / description
      Previous value: -"Selector only: zero-based DOM index, AX tree order for role."New value: +"Zero-based match index."
    • removedInput schema / properties / observe / additionalProperties
      Removed value: -false
    • addedInput schema / properties / observe / anyOf
      Added value: +[
      +  {
      +    "additionalProperties": false,
      +    "properties": {
      +      "frame": {
      +        "additionalProperties": false,
      +        "description": "Child frame; see shared locator rules.",
      +        "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": "Exact AX name; role only.",
      +        "maxLength": 10000,
      +        "type": "string"
      +      },
      +      "nth": {
      +        "description": "Zero-based match index.",
      +        "maximum": 9007199254740991,
      +        "minimum": 0,
      +        "type": "integer"
      +      },
      +      "popup_selector": {
      +        "description": "Unique CSS popup in control frame; default controls/owns relations or descendants.",
      +        "maxLength": 10000,
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "ref": {
      +        "type": "string"
      +      },
      +      "selector": {
      +        "description": "Locator query.",
      +        "maxLength": 10000,
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "selector_type": {
      +        "description": "Default css.",
      +        "enum": [
      +          "css",
      +          "xpath",
      +          "label",
      +          "placeholder",
      +          "role"
      +        ],
      +        "type": "string"
      +      },
      +      "timeout_ms": {
      +        "default": 1000,
      +        "maximum": 5000,
      +        "minimum": 100,
      +        "type": "integer"
      +      }
      +    },
      +    "type": "object"
      +  },
      +  {
      +    "additionalProperties": false,
      +    "properties": {
      +      "diff_since": {
      +        "maxLength": 128,
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "max_chars": {
      +        "maximum": 2000000,
      +        "minimum": 1,
      +        "type": "integer"
      +      },
      +      "max_nodes": {
      +        "maximum": 3000,
      +        "minimum": 1,
      +        "type": "integer"
      +      },
      +      "timeout_ms": {
      +        "default": 5000,
      +        "maximum": 30000,
      +        "minimum": 100,
      +        "type": "integer"
      +      },
      +      "verbose": {
      +        "type": "boolean"
      +      }
      +    },
      +    "required": [
      +      "diff_since"
      +    ],
      +    "type": "object"
      +  }
      +]
    • changedInput schema / properties / observe / description
      Previous value: -"Read this explicit control after the action within its remaining budget; observation is separate from delivery. No assertion or automatic replay."New value: +"Post-action control read or snapshot diff; see shared observation rules."
    • removedInput schema / properties / observe / properties
      Removed value: -{
      -  "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"
      -  }
      -}
    • removedInput schema / properties / observe / type
      Removed value: -"object"
    • changedInput schema / properties / selector / description
      Previous value: -"Query by selector_type; role example: selector=\"link\", name=\"Claim\"."New value: +"Locator query."
    • changedInput schema / properties / selector_type / description
      Previous value: -"Default css. label: exact associated HTML label, whitespace normalized. placeholder: exact attribute."New value: +"Default css."
    • changedInput schema / properties / timeout_ms / description
      Previous value: -"Total preparation/dispatch/verification and optional observation budget."New value: +"Total action, wait and observation budget."
    • addedInput schema / properties / wait_for
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Post-action checks (same conditions as wait); shares the total action budget. Result is wait_result, never input replay.",
      +  "properties": {
      +    "checks": {
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "condition": {
      +            "enum": [
      +              "attached",
      +              "absent",
      +              "visible",
      +              "actionable",
      +              "text",
      +              "value",
      +              "checked",
      +              "selected",
      +              "expanded",
      +              "url",
      +              "network_idle",
      +              "count",
      +              "value_present"
      +            ],
      +            "type": "string"
      +          },
      +          "expected": {
      +            "anyOf": [
      +              {
      +                "maxLength": 100000,
      +                "type": "string"
      +              },
      +              {
      +                "type": "boolean"
      +              },
      +              {
      +                "maximum": 9007199254740991,
      +                "minimum": 0,
      +                "type": "integer"
      +              }
      +            ],
      +            "description": "text/url: substring; value: exact; count: integer; states: boolean (checked also mixed)."
      +          },
      +          "frame": {
      +            "additionalProperties": false,
      +            "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": {
      +            "type": "string"
      +          },
      +          "idle_ms": {
      +            "maximum": 10000,
      +            "minimum": 100,
      +            "type": "integer"
      +          },
      +          "name": {
      +            "maxLength": 10000,
      +            "type": "string"
      +          },
      +          "not": {
      +            "type": "boolean"
      +          },
      +          "nth": {
      +            "maximum": 9007199254740991,
      +            "minimum": 0,
      +            "type": "integer"
      +          },
      +          "previous": {
      +            "description": "text: full prior innerText; exclusive with expected.",
      +            "maxLength": 100000,
      +            "type": "string"
      +          },
      +          "selector": {
      +            "maxLength": 10000,
      +            "minLength": 1,
      +            "type": "string"
      +          },
      +          "selector_type": {
      +            "enum": [
      +              "css",
      +              "xpath",
      +              "label",
      +              "placeholder",
      +              "role"
      +            ],
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "condition"
      +        ],
      +        "type": "object"
      +      },
      +      "maxItems": 30,
      +      "minItems": 1,
      +      "type": "array"
      +    },
      +    "timeout_ms": {
      +      "default": 5000,
      +      "maximum": 30000,
      +      "minimum": 100,
      +      "type": "integer"
      +    }
      +  },
      +  "required": [
      +    "checks"
      +  ],
      +  "type": "object"
      +}
  2. 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."
  3. 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."
  4. First observedv0.24.0

TDQS

B3.4/5.0
Behavior3/5

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

No annotations are present, so the description carries full behavioral burden. It discloses trusted keydown reporting, guard-mismatch abort semantics and the supported key set, but omits dialog_policy handling, the shared action timeout budget, and how observe/wait_for interact with the action.

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 tight sentences, front-loaded with the core verb and resource, then guard semantics, then key coverage. No filler, though the key-support sentence could be folded more compactly.

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 13-parameter tool with nested observe/wait_for objects and no output schema or annotations, the description covers the core dispatch and guard behavior but leaves the observation, wait and dialog surfaces to schema-only references, which is thin relative to the tool's complexity.

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 69%, so baseline is 3. The description meaningfully adds the value domain of the undocumented 'key' parameter (F1–F12, navigation/editing, US ASCII punctuation) and clarifies ref/selector guard semantics, but says nothing about nth, frame, observe, wait_for, tab_handle or dialog_policy.

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?

States a specific action: 'Send a native key/chord to current focus and report its trusted keydown target.' The phrase 'native key/chord' distinguishes it from text-entry siblings like browser_type without naming them 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?

Explains the ref/selector guard ('guards focus without focusing it; a mismatch before dispatch sends no key'), which is useful usage context, but never states when to prefer this over browser_type or browser_fill, nor when to omit the guard.

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