Skip to content

Conversation

Coquinate
Copy link
Contributor

Summary

Adds a new press_key tool that enables keyboard input automation, supporting both single keys and key combinations with modifiers.

Features

  • Single key press (e.g., "Enter", "Escape", "Tab", "ArrowLeft")
  • Key combinations with modifiers (e.g., "Control+A", "Control+Shift+T")
  • Edge case handling (e.g., "Control++" for plus key with modifier)

Implementation

  • Added splitKeyCombo() helper function to parse key combinations
  • Supports modifier keys: Control, Shift, Alt, Meta
  • Presses modifiers in order, releases in reverse order
  • Includes comprehensive tests covering all scenarios
  • Updated documentation (tool count: 26 → 27)

Test Results

All tests passing:

  • ✅ Single key press
  • ✅ Key combinations
  • ✅ Plus key with modifier edge case
  • ✅ Multiple modifiers

Test Plan

  • Build succeeds
  • All existing tests pass
  • New press_key tests pass
  • Documentation generated correctly

Add WebP format to screenshot tool, providing superior compression
compared to JPEG. Also fixes bug where saveTemporaryFile always
saved files with .png extension regardless of format.
Add press_key tool that supports single keys and key combinations with modifiers.

Features:
- Single key press (e.g., "Enter", "Escape", "Tab")
- Key combinations with modifiers (e.g., "Control+A", "Control+Shift+T")
- Edge case handling (e.g., "Control++" for plus key with modifier)

Implementation:
- Added splitKeyCombo() helper function to parse key combinations
- Handles modifier keys: Control, Shift, Alt, Meta
- Presses modifiers in order, releases in reverse order
- Includes comprehensive tests for all scenarios
- Updated documentation with 27 tools (was 26)
Copy link
Collaborator

@OrKoN OrKoN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the PR! left a few comments

- Move splitKeyCombo to src/third_party/playwright/keyboard.ts
- Add Playwright LICENSE and README with source attribution
- Replace @ts-expect-error with proper KeyInput type casts
- Update press_key description to clarify when to use vs fill()
- Standardize input tool schema descriptions using uidSchema
@Coquinate
Copy link
Contributor Author

Updated to address feedback - moved keyboard utilities to third_party/playwright with proper attribution, replaced type suppressions with casts, and clarified when to use press_key vs fill().

@Coquinate Coquinate requested a review from OrKoN October 10, 2025 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants