Skip to main content
Glama

press_b

Simulate pressing the B button on a GameBoy emulator. Configure the duration in frames to control how long the button is held, enabling precise input for gameplay or testing.

Instructions

Press the B button on the GameBoy

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
duration_framesNoNumber of frames to hold the button

Implementation Reference

  • Async handler function executed when the 'press_b' tool is called. It presses the B button for the specified number of frames via emulatorService and returns the updated 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] };
    }
  • Zod schema defining the input parameters for the press_b tool: optional duration_frames (defaults to 25).
    {
      duration_frames: z.number().int().positive().optional().default(1).describe('Number of frames to hold the button').default(25)
    },
  • src/tools.ts:21-36 (registration)
    Loop that registers the 'press_b' tool (when button==='B') on the MCP server, including name, description, schema, and handler.
    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] };
        }
      );
  • Invokes registration of press_b tool (via registerGameBoyTools) on the MCP server instance.
    // Register GameBoy tools
    registerGameBoyTools(server, emulatorService); // Pass emulatorService
  • Supporting method called by the tool handler to press the specified button (B for press_b) and return the screen.
    pressButton(button: GameBoyButton, durationFrames: number): ImageContent {
      log.debug(`Pressing button: ${button}`);
      if (!this.isRomLoaded()) {
        log.warn('Attempted to press button with no ROM loaded');
        throw new Error('No ROM loaded');
      }
      this.emulator.pressButton(button, durationFrames); // This advances one frame
      return this.getScreen();
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action but lacks details on effects (e.g., in-game response, timing), prerequisites (e.g., requires a loaded ROM), or side effects (e.g., might trigger game events). This is a significant gap for a tool that likely interacts with a game system.

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 waste. It is front-loaded with the core action and resource, making it immediately clear and appropriately sized for a simple tool.

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

Completeness2/5

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

Given the complexity of interacting with a GameBoy (implied by sibling tools like load_rom and get_screen), the description is incomplete. With no annotations, no output schema, and minimal behavioral context, it fails to address key aspects like how the press integrates with game state or what feedback to expect, leaving gaps for effective tool 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 already documents the 'duration_frames' parameter fully. The description adds no additional parameter semantics beyond what the schema provides, such as typical usage scenarios or effects of varying durations, meeting the baseline for high schema coverage.

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

Purpose5/5

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

The description clearly states the specific action ('Press') and target resource ('the B button on the GameBoy'), distinguishing it from sibling tools like press_a, press_up, etc. It precisely identifies what the tool does without ambiguity.

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. While the description implies it's for pressing the B button, it doesn't specify contexts (e.g., in-game actions, menu navigation) or exclusions compared to other press_* tools, leaving usage unclear.

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

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