Skip to main content
Glama

wait_frames

Pauses execution for a specified number of frames in the MCP GameBoy Server, enabling precise timing control during GameBoy emulation operations.

Instructions

Wait for a specified number of frames

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
duration_framesNoNumber of frames to wait

Implementation Reference

  • src/tools.ts:40-51 (registration)
    Registers the wait_frames tool with the MCP server. Includes inline Zod input schema, description, and the handler function that executes emulatorService.waitFrames and returns the resulting screen as ImageContent.
    server.tool(
      'wait_frames',
      'Wait for a specified number of frames',
      {
        duration_frames: z.number().int().positive().describe('Number of frames to wait').default(100)
      },
      async ({ duration_frames }): Promise<CallToolResult> => {
        // Wait for frames using the service
        const screen = emulatorService.waitFrames(duration_frames);
        return { content: [screen] };
      }
    );
  • TypeScript interface defining the expected input parameters for the wait_frames tool.
    export interface WaitFramesToolSchema {
      duration_frames: number;
    }
  • Core implementation of frame waiting in EmulatorService class. Advances the emulator for the specified number of frames by calling doFrame() in a loop and returns the current screen.
    waitFrames(durationFrames: number): ImageContent {
      log.debug(`Waiting for ${durationFrames} frames`);
      if (!this.isRomLoaded()) {
        log.warn('Attempted to wait frames with no ROM loaded');
        throw new Error('No ROM loaded');
      }
      for (let i = 0; i < durationFrames; i++) {
        this.emulator.doFrame();
      }
      log.verbose(`Waited ${durationFrames} frames`, JSON.stringify({ frames: durationFrames }));
      return this.getScreen();
    }
Install Server

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