Skip to main content
Glama

press_keys

Send real keystrokes to the page to trigger keyboard events that form-field filling misses. Type text or press keys like Enter, ArrowDown, and Control+A for games, canvas editors, and shortcut-driven UIs.

Instructions

Send real keystrokes to the page, rather than into a form field.

fill_field writes into an <input>. This types at whatever holds keyboard focus, which is what word games, canvas editors (Figma, Excalidraw), terminal emulators, and keyboard-shortcut UIs actually listen to: they bind keydown/keyup on window or document, so setting an input's value never reaches them and there is often no input to target in the first place.

Examples: press_keys(text="crane", keys=["Enter"]) # type a word, submit it press_keys(keys=["ArrowDown"], repeat=3) # move a selection press_keys(keys=["Control+a", "Backspace"]) # select all, clear press_keys(text="hello", selector="#chat") # focus first, then type

Args: text: Literal text to type one character at a time, firing the full keydown → keypress → input → keyup sequence per character. Typed BEFORE keys, so text="crane", keys=["Enter"] does the right thing. keys: Key names pressed in order — ["Enter"], ["Escape"], ["ArrowLeft"] — or chords like ["Control+a"], ["Shift+Tab"]. Playwright names: Enter, Tab, Escape, Backspace, Delete, ArrowUp/Down/Left/Right, Home, End, PageUp, PageDown, F1–F12, and single characters. selector: CSS selector to focus first. Omit to send keys to whatever already has focus — the usual case for games and canvas apps. delay_ms: Milliseconds per keystroke (0–1000). 0 is fastest; use 20–80 on sites that check typing cadence. repeat: Press the keys sequence this many times (1–50). Does not repeat text. wait_for: CSS selector to wait for afterwards, in this same call. wait_for_predicate: JS expression polled until truthy afterwards. wait_until: Readiness signal afterwards — 'none' (default), 'dom_settled' (wait for the DOM to stop changing; prefer this over a fixed sleep), 'networkidle', 'load', 'domcontentloaded', 'settle'.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keysNo
textNo
repeatNo
delay_msNo
selectorNo
wait_forNo
wait_untilNonone
wait_for_predicateNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.5.0

TDQS

A5/5.0
Behavior5/5

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

With no annotations present, the description carries the full behavioral burden and does so thoroughly. It discloses the per-character event sequence, that text is typed before keys, that repeat does not apply to text, and the semantics of each wait option. This far exceeds what a schema alone could convey.

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 front-loaded with the key differentiator, followed by compact examples and parameter definitions. The length is justified because it needs to document a behaviorally rich tool with eight parameters, and every sentence adds useful information without redundancy.

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?

The description is complete for a keyboard-input tool of this complexity. It covers target focus behavior, ordering, chord syntax, typing cadence, repetition, focus targeting, and all wait behaviors. Return values are not explained, but an output schema exists, so that burden is already handled elsewhere.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the parameter notes in the description are essential. Every one of the eight parameters is explained with type expectations, examples, constraints, or default behavior, including subtle points like delay_ms range and the effect of repeat.

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 opens with a specific verb and resource: 'Send real keystrokes to the page, rather than into a form field.' It clearly distinguishes this tool from fill_field by explaining that it targets whatever holds keyboard focus rather than an input element's value.

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

Usage Guidelines5/5

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

The description explicitly names fill_field as the alternative and explains when press_keys is needed: word games, canvas editors, terminal emulators, and keyboard-shortcut UIs that listen to keydown/keyup. It also gives concrete examples showing common call patterns, leaving no ambiguity about when to choose this tool.

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