Skip to main content
Glama

get_screen

Retrieve the current GameBoy screen frame to monitor or analyze gameplay, advancing the emulator by one frame automatically for precise control.

Instructions

Get the current GameBoy screen (advances one frame)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Inline handler function for the 'get_screen' MCP tool. Advances the emulator by one frame and returns the current screen as ImageContent.
    async (): Promise<CallToolResult> => { // Advance one frame and get the screen using the service const screen = emulatorService.advanceFrameAndGetScreen(); return { content: [screen] }; }
  • src/tools.ts:68-77 (registration)
    Registration of the 'get_screen' tool using McpServer.tool() method, including description, empty input schema, and handler.
    server.tool( 'get_screen', 'Get the current GameBoy screen (advances one frame)', // Updated description {}, async (): Promise<CallToolResult> => { // Advance one frame and get the screen using the service const screen = emulatorService.advanceFrameAndGetScreen(); return { content: [screen] }; } );
  • TypeScript interface defining the input schema for get_screen tool (no parameters).
    export interface GetScreenToolSchema { // No parameters needed }
  • Helper method advanceFrameAndGetScreen() called by the tool handler to advance one frame and retrieve the screen image.
    advanceFrameAndGetScreen(): ImageContent { log.verbose('Advancing one frame and getting screen'); if (!this.isRomLoaded()) { log.warn('Attempted to advance frame with no ROM loaded'); throw new Error('No ROM loaded'); } this.emulator.doFrame(); return this.getScreen(); }
  • Helper method getScreen() that captures the current emulator screen as base64 PNG ImageContent, used by advanceFrameAndGetScreen().
    getScreen(): ImageContent { log.verbose('Getting current screen'); if (!this.isRomLoaded()) { log.warn('Attempted to get screen with no ROM loaded'); throw new Error('No ROM loaded'); } const screenBase64 = this.emulator.getScreenAsBase64(); const screen: ImageContent = { type: 'image', data: screenBase64, mimeType: 'image/png' }; log.verbose('Screen data retrieved', JSON.stringify({ mimeType: screen.mimeType, dataLength: screen.data.length })); return screen; }

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