Skip to main content
Glama

press_right

Simulate pressing the RIGHT button on a GameBoy emulator using the MCP GameBoy Server. Specify the duration in frames for precise control during gameplay or testing.

Instructions

Press the RIGHT button on the GameBoy

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
duration_framesNoNumber of frames to hold the button

Implementation Reference

  • The core handler logic for the 'press_right' tool (shared with other press_ buttons). It calls emulatorService.pressButton('RIGHT', duration_frames) and returns the current screen as ImageContent.
    async ({ duration_frames }): Promise<CallToolResult> => { // Press the button using the service (advances one frame) emulatorService.pressButton(button, duration_frames); // Return the current screen using the service const screen = emulatorService.getScreen(); return { content: [screen] }; }
  • Input schema for press_right tool using Zod validation for duration_frames parameter.
    { duration_frames: z.number().int().positive().optional().default(1).describe('Number of frames to hold the button').default(25) },
  • src/tools.ts:21-37 (registration)
    Dynamic registration of press_right (and other direction/button) tools via loop over GameBoyButton enum values.
    Object.values(GameBoyButton).forEach(button => { server.tool( `press_${button.toLowerCase()}`, `Press the ${button} button on the GameBoy`, { duration_frames: z.number().int().positive().optional().default(1).describe('Number of frames to hold the button').default(25) }, async ({ duration_frames }): Promise<CallToolResult> => { // Press the button using the service (advances one frame) emulatorService.pressButton(button, duration_frames); // Return the current screen using the service const screen = emulatorService.getScreen(); return { content: [screen] }; } ); });
  • Top-level registration call in createGameBoyServer that invokes the tools registration including press_right.
    // Register GameBoy tools registerGameBoyTools(server, emulatorService); // Pass emulatorService
  • GameBoyButton enum defining 'RIGHT' which generates the 'press_right' tool name when lowercased.
    export enum GameBoyButton { UP = 'UP', DOWN = 'DOWN', LEFT = 'LEFT', RIGHT = 'RIGHT', A = 'A', B = 'B', START = 'START', SELECT = 'SELECT' }

Other Tools

Related 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/mario-andreschak/mcp-gameboy'

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