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));
Behavior1/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. 'Press the key' implies a mutation action but offers no details on effects, permissions, or side effects (e.g., whether it triggers page navigation or requires focus). This is inadequate for a tool that likely interacts with browser elements.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is overly concise to the point of under-specification. 'Press the key' is a single phrase that fails to provide necessary context or structure, making it inefficient rather than appropriately brief.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what 'pressing a key' entails in this context (e.g., browser automation), what happens after execution, or how it differs from similar tools, leaving significant gaps for an agent to understand its use.

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%, with clear descriptions for both parameters ('key' and 'selector'). The description adds no additional meaning beyond the schema, but the schema itself is well-documented, justifying a baseline score of 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Press the key' is a tautology that restates the tool name without adding meaningful context. It specifies the action (press) but doesn't clarify what resource or context this applies to (e.g., a browser element), making it vague compared to more specific sibling tools like 'click-element' or 'fill-input'.

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

Usage Guidelines1/5

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

No guidance is provided on when to use this tool versus alternatives. It doesn't mention context, prerequisites, or exclusions, leaving the agent to guess its application relative to siblings like 'click-element' or 'fill-input' in browser automation scenarios.

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

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