Skip to main content
Glama
zillow
by zillow

pressKey

Press hardware keys on mobile devices for automation testing. Simulate actions like home, back, menu, power, and volume controls on Android and iOS platforms.

Instructions

Press a hardware key on the device (Maestro equivalent of pressButton)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesThe key to press
platformYesPlatform of the device

Implementation Reference

  • The pressKey tool handler function. Creates a PressButton instance and executes it with the provided key, then returns a formatted JSON response.
    const pressKeyHandler = async (device: BootedDevice, args: PressKeyArgs, progress?: ProgressCallback) => {
      const pressButton = new PressButton(device);
      const result = await pressButton.execute(args.key, progress);
    
      return createJSONToolResponse({
        message: `Pressed key ${args.key}`,
        observation: result.observation,
        ...result
      });
    };
  • Zod schema defining the input arguments for the pressKey tool: key (enum of hardware keys) and platform.
    export const pressKeySchema = z.object({
      key: z.enum(["home", "back", "menu", "power", "volume_up", "volume_down", "recent"])
        .describe("The key to press"),
      platform: z.enum(["android", "ios"]).describe("Platform of the device")
    });
  • Registration of the pressKey tool using ToolRegistry.registerDeviceAware, providing name, description, schema, handler, and progress support.
    ToolRegistry.registerDeviceAware(
      "pressKey",
      "Press a hardware key on the device (Maestro equivalent of pressButton)",
      pressKeySchema,
      pressKeyHandler,
      true // Supports progress notifications
    );
  • TypeScript interface defining the PressKeyArgs type used by the handler.
    export interface PressKeyArgs {
      key: "home" | "back" | "menu" | "power" | "volume_up" | "volume_down" | "recent";
      platform: Platform;
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions this is a 'Maestro equivalent' which suggests some emulation behavior, but doesn't disclose whether this requires specific device states, what happens if the key press fails, whether it's synchronous/asynchronous, or any side effects. For a hardware interaction tool with zero annotation coverage, this is inadequate.

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 a single, efficient sentence that gets straight to the point with zero wasted words. It's appropriately sized for a simple action tool and front-loads the core functionality.

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

Completeness3/5

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

For a hardware interaction tool with 2 parameters, 100% schema coverage, but no annotations or output schema, the description is minimally adequate. It states what the tool does but lacks important behavioral context about how the key press actually works, what happens on different platforms, or what the expected outcomes are.

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 both parameters clearly documented in the schema. The description adds no additional parameter information beyond what's already in the structured schema. The baseline score of 3 is appropriate when the schema does all the parameter documentation work.

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

Purpose4/5

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

The description clearly states the action ('Press a hardware key') and target resource ('on the device'), with a specific verb+resource combination. It distinguishes from the sibling 'pressButton' by specifying this is the 'Maestro equivalent', though it doesn't fully explain the functional difference between pressing a hardware key versus a software button.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'pressButton' or other input methods. While it mentions this is the 'Maestro equivalent of pressButton', it doesn't clarify the specific use cases for hardware keys versus software buttons or when this tool is preferred.

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/zillow/auto-mobile'

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