Skip to main content
Glama

browser_press_key

Press keyboard keys or combos like Enter, Escape, or Control+c on a webpage or focused element. Simulate user interactions for automated browser testing and form submissions.

Instructions

Press a keyboard key or combo on the current page or focused element. Supports single keys (Enter, Escape, Tab, ArrowDown) and combos (Control+c, Shift+Tab).

中文详情:

  • 用途:在当前页面或指定元素上按下键盘按键,支持单个按键或组合键(如 Control+c)

  • 何时使用:表单输入后按 Enter 提交时;模态框按 Escape 关闭时;下拉菜单用 ArrowDown 导航时;快捷键组合测试时

  • 输出:{ ok: boolean, key: string, selector: string|null, timestamp: string }

  • 参数:

    • key (string, 必填):按键名称,如 Enter/Escape/Tab/ArrowDown/Backspace/a/Control+c

    • selector (string, 可选):在指定元素上按键(先聚焦再按键)

  • 错误:key 为空抛出 'Key is required';selector 无匹配抛出 'element not found'

  • 示例:{"key":"Enter","selector":"#search-input"}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYes按键名称,如 Enter、Escape、Tab、ArrowDown、Backspace、a、Control+c 等
selectorNo可选,在指定元素上按键(先聚焦再按键)
Behavior4/5

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

With no annotations, the description carries the full burden. It discloses supported keys/combos, that it presses on current page or focused element, and details the output structure (ok, key, selector, timestamp) and errors ('Key is required', 'element not found'). It does not mention whether it waits for action completion or handles modifiers.

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?

The description is structured: English summary followed by Chinese details. It is not overly long, but the Chinese section is a duplicate. The core English part is concise and front-loaded with purpose.

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?

Despite no output schema in the input definition, the description provides the output structure, error conditions, and usage examples. For a keyboard press tool with 2 parameters, this covers all necessary information for correct invocation.

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 100%, baseline 3. The description adds value by explaining key parameter with common values (Enter, Escape, etc.) and specifying that selector is optional and focuses first. The Chinese section provides additional examples and error handling details.

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?

The description clearly states it presses a keyboard key or combo on the current page or focused element, distinguishing it from sibling tools like browser_click (clicking) and browser_type (typing text). It lists supported keys and combos, making the purpose specific.

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?

The description includes explicit 'when to use' scenarios in Chinese (form submission, modal close, dropdown navigation, shortcut testing). It implies not for typing text since browser_type exists, but lacks explicit 'when not to use' or direct comparison with browser_type.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/validpilot/ai-verify-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server