Skip to main content
Glama
AdsPower

AdsPower LocalAPI MCP Server

Official

press-key

Simulate keyboard key presses on web elements to automate browser interactions within AdsPower profiles.

Instructions

Press the key

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesThe key to press, eg: "Enter"
selectorNoThe selector of the element to press the key, find from the page source code

Implementation Reference

  • The pressKey handler function that checks connection, optionally focuses a selector, presses the specified key using Puppeteer's keyboard, and returns success message.
    async pressKey({ key, selector }: PressKeyParams) { browser.checkConnected(); if (selector) { await browser.pageInstance!.waitForSelector(selector); await browser.pageInstance!.focus(selector); } await browser.pageInstance!.keyboard.press(key); return `Pressed key: ${key} successfully`; },
  • Zod schema for 'press-key' tool parameters: required 'key' string and optional 'selector' string.
    pressKeySchema: z.object({ key: z.string().describe('The key to press, eg: "Enter"'), selector: z.string().optional().describe('The selector of the element to press the key, find from the page source code') }).strict(),
  • Registers the 'press-key' tool on the MCP server with description, input schema, and wrapped automationHandlers.pressKey handler.
    server.tool('press-key', 'Press the key', schemas.pressKeySchema.shape, wrapHandler(automationHandlers.pressKey));

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/AdsPower/local-api-mcp-typescript'

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