Skip to main content
Glama

Press key

browser_press_key

Presses a keyboard key in a live browser session, optionally targeting a specific element via CSS selector or accessible name, using Playwright-compatible key names.

Instructions

Presses a key, optionally focused on an element. Key names follow Playwright ("Enter", "Escape", "ArrowDown", "Control+a").

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cssNoCSS selector, as an alternative to ref.
keyYes
refNoElement ref from the most recent snapshot, e.g. "e12". Preferred — refs are exact. Only valid for the page state that produced them.
nameNoAccessible name to match alongside role.
roleNoARIA role, e.g. "button". Combine with name for an accessible-name match.
indexNoWhich match to use when the selector is ambiguous (0-based, default 0).
sessionIdYesSession id returned by browser_start.
Behavior2/5

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

Annotations only indicate readOnlyHint=false and openWorldHint=true, so the description carries the burden of explaining behavior. It adds that key names follow Playwright, which is helpful, but does not disclose possible side effects (e.g., navigation triggers), how focusing works, or error conditions. This is insufficient for a mutating tool.

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

Conciseness5/5

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

Two concise sentences with no fluff. The action is front-loaded, and the Playwright key-name note is directly relevant. Ideal length for this tool.

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?

The description covers the core purpose but leaves several aspects unexplained: how to combine multiple element-targeting parameters (ref vs css vs role+name), the precedence or conflict resolution, and any return value or error behavior. Given seven parameters and two required, this is a moderate gap. However, schema descriptions fill some gaps, so a 3 is fair.

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 description coverage is 86%, so baseline is 3. The description adds specific value for the 'key' parameter by specifying Playwright key names, which the schema lacks. It also clarifies that element parameters are used to focus before pressing, augmenting the schema's generic selector descriptions.

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 clearly states the action ('Presses a key') and the optional focused element, which is understandable. It does not explicitly differentiate from siblings like browser_type or browser_click, but the resource (key) is distinct enough for an agent to recognize the purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description does not mention exclusions or context for using browser_type for text input or when a key press is preferred. The agent must infer usage from the tool name and siblings.

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/hofmeister/web-ui-tester'

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