scrapeless-mcp-server 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -64,6 +64,9 @@ This project provides several MCP servers that enable AI assistants like Claude
64
64
  - `browser_scroll_to`
65
65
  Scroll a specific element into view.
66
66
 
67
+ - `browser_press_key`
68
+ Simulate a key press.
69
+
67
70
  ### Universal Tools
68
71
 
69
72
  - `scrape_html`
@@ -442,3 +442,42 @@ export const browserScrollTo = defineTool({
442
442
  }
443
443
  },
444
444
  });
445
+ export const browserPressKey = defineTool({
446
+ name: "browser_press_key",
447
+ description: `Simulate a key press.
448
+ Restrictions: Must specify a valid key name; optional target selector.
449
+ Valid: Press Enter in #search.
450
+ Invalid: Press a key without specifying the key name.`,
451
+ inputSchema: {
452
+ selector: z.string().describe("The CSS selector of the element to focus.").optional(),
453
+ key: z.string().describe('Name of the key to press or a character to generate, such as `ArrowLeft` or `a`'),
454
+ },
455
+ handle: async (context, params) => {
456
+ const session = context.getSession(params.sessionId);
457
+ if (!session?.page) {
458
+ return wrapMcpBrowserResponse("No active browser session found. Please create a browser session first.");
459
+ }
460
+ try {
461
+ if (params.selector) {
462
+ await session.page.focus(params.selector);
463
+ }
464
+ await session.page.keyboard.press(params.key);
465
+ const accessibilitySnapshot = await snapshot(session.page);
466
+ return {
467
+ content: [
468
+ {
469
+ type: "text",
470
+ text: params.selector ? `Focus on the ${params.selector} and press ${params.key}` : `press ${params.key}`,
471
+ },
472
+ {
473
+ type: "text",
474
+ text: accessibilitySnapshot,
475
+ },
476
+ ],
477
+ };
478
+ }
479
+ catch (error) {
480
+ return wrapMcpBrowserResponse(`Failed to press key: ${error.message}`);
481
+ }
482
+ },
483
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scrapeless-mcp-server",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "bin": {