Skip to main content
Glama

press_button

Press hardware buttons on iOS simulators to simulate device interactions like home, lock, side button, and Siri actions for automated testing and control.

Instructions

Press a hardware button on the simulator

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
buttonYesButton to press
udidNoSimulator UDID (optional, defaults to booted simulator)

Implementation Reference

  • The pressButton handler method, which executes the 'idb ui button' command to trigger hardware button presses on the iOS simulator.
    private async pressButton(button: string, udid?: string) {
      const target = await resolveUdid(udid);
      try {
        await execAsync(`idb ui button --udid ${target} ${button}`);
        return {
          content: [{ type: 'text', text: `Pressed ${button} on ${target}` }],
        };
      } catch (error: any) {
        throw new McpError(ErrorCode.InternalError, `Failed to press button: ${error.message}`);
      }
    }
  • The JSON schema definition for the 'press_button' tool, defining the allowed button enum and optional UDID parameter.
    {
      name: 'press_button',
      description: 'Press a hardware button on the simulator',
      inputSchema: {
        type: 'object',
        properties: {
          button: {
            type: 'string',
            enum: ['HOME', 'LOCK', 'SIDE_BUTTON', 'SIRI'],
            description: 'Button to press',
          },
          udid: { type: 'string', description: 'Simulator UDID (optional, defaults to booted simulator)' },
        },
        required: ['button'],
        additionalProperties: false,
      },
    },
  • src/index.ts:528-529 (registration)
    The registration/dispatch logic inside the CallToolRequestSchema handler that routes 'press_button' requests to the class method.
    case 'press_button':
      return this.pressButton(args.button as string, args.udid);
Behavior2/5

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

With no annotations, the description carries full burden but only states the basic action without behavioral details. It doesn't disclose effects (e.g., state changes in the simulator), error conditions, or any constraints like simulator readiness, leaving significant gaps.

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 with zero wasted words, front-loading the core action. It's appropriately sized for a simple tool with well-documented parameters.

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 tool with no annotations and no output schema, the description is minimal but covers the basic purpose. However, it lacks details on behavioral impact and usage context, making it incomplete for guiding an agent in complex scenarios, though adequate for straightforward 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%, so the schema fully documents both parameters. The description adds no additional meaning beyond implying hardware button interaction, which is already clear from the enum values. Baseline 3 is appropriate as the schema handles parameter documentation.

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') and target ('hardware button on the simulator'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'tap' or 'swipe' that also involve simulator interactions, missing explicit distinction.

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?

No guidance is provided on when to use this tool versus alternatives like 'tap' or 'swipe', nor does it mention prerequisites such as needing a booted simulator. The description lacks context for tool selection among siblings.

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/xmuweili/app-screen-mcp'

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