Skip to main content
Glama

press_key

Simulate keyboard key presses on a web page or specific element to trigger form submission, close modals, navigate focus, or execute shortcuts. Returns updated page state after the keypress.

Instructions

Dispatch a keyboard key press event on the page or a targeted element. Supports named keys (Enter, Escape, Tab, ArrowDown, Backspace) and character keys. Returns post-action page_state reflecting any DOM changes caused by the keypress. Use for form submission (Enter), closing modals (Escape), focus navigation (Tab), or keyboard shortcuts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesKey to press — use Playwright key names: "Enter", "Escape", "Tab", "ArrowDown", "ArrowUp", "Backspace", "Space", or single characters like "a". Modifier combos: "Control+a", "Shift+Tab".
selectorNoOptional CSS selector or @eN ref to focus before pressing the key. If omitted, the key is dispatched to the currently focused element or the page.
Behavior4/5

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

With no annotations provided, the description carries full burden. It discloses the return value ('post-action page_state reflecting any DOM changes'), indicating side effects. It lists supported key types (named keys, character keys, modifier combos). It does not mention permissions, rate limits, or potential destructive outcomes, but the tool is inherently non-destructive in normal use.

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?

The description is two efficient sentences plus a use-case list. Every sentence is informative: first sentence states purpose, second describes return value, third lists concrete use cases. No redundant or extraneous content.

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?

Given the tool's simplicity (keyboard press), the description covers purpose, supported keys, use cases, and return value. The schema fully documents parameters. No output schema is needed as the return is explained. The description is complete for an agent to correctly select and invoke the tool.

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 description coverage is 100% (both parameters have descriptions). The description largely duplicates the schema (e.g., mentions Playwright key names) with minor additions (example named keys). Per scoring guidelines, baseline is 3 when coverage is high, and the description adds limited extra value beyond the schema.

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 the tool dispatches a keyboard key press event on the page or a targeted element, with specific examples of supported keys (Enter, Escape, Tab, etc.) and use cases (form submission, modal closing, focus navigation, keyboard shortcuts). This distinguishes it from sibling tools like click, hover, and scroll which handle different interactions.

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 explicitly lists when to use the tool: 'Use for form submission (Enter), closing modals (Escape), focus navigation (Tab), or keyboard shortcuts.' It implies alternatives (e.g., click for clicking), but does not explicitly state when not to use it or mention alternatives by name. This is clear but lacks exclusions.

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/Mingye-Lu/AgenticCrawler'

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