Skip to main content
Glama

mgba_press_buttons

Append a button press to the mGBA input queue, holding buttons for a set number of frames and releasing before the next press. Drive Game Boy Advance games programmatically with precise input timing.

Instructions

PURPOSE: Append a button-press to mGBA's input FIFO — hold the given buttons for frames frames, then release for release_frames frames before the next queued press starts. USAGE: Use to drive games with input. Each call APPENDS to the queue rather than overwriting, so consecutive calls produce distinct edge events that ROMs see as separate presses (rather than one continuous hold). To press the same button twice in a row reliably, send two presses — release_frames between them gives the ROM time to detect a key-up, which most input handlers require to register the second press. To advance emulation manually (without queueing inputs), use mgba_advance_frames. To inspect input-state side effects, pause first with mgba_pause and read RAM between presses. BEHAVIOR: Modifies the bridge's input queue; the press fires asynchronously on mGBA's frame callback. The call returns immediately with the new queue size — it does NOT block until the press completes. Returns an error if buttons contains a name not in the valid-key set, or if the bridge's input handling isn't installed on this build. RETURNS: Single line 'Queued press: KEYS (hold Nf, release Mf). Queue size: K'.

Valid button names: A, B, Select, Start, Right, Left, Up, Down, R, L.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
buttonsYesList of button names to hold simultaneously for this press (e.g. ["A"], ["Down", "B"] for a Konami-code-style combo). Names are case-sensitive. An unknown name returns an error rather than being silently ignored.
framesNoNumber of frames to hold the buttons down (at 60 fps; default 1). For a normal menu-confirm tap, 2-4 is usually plenty; for held-direction movement on slower games, increase as needed.
release_framesNoNumber of frames to release ALL keys after the hold, before the next queued press fires (default 1). Increase to 2-4 if a ROM debounces input and misses back-to-back presses; this gap is what lets the ROM see two distinct edge events instead of one long hold.
Behavior5/5

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

With no annotations provided, the description fully discloses behavioral traits: queue is appended (not overwritten), press fires asynchronously, returns immediately with queue size, and errors on invalid buttons or missing bridge support. This covers all important side effects and async behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with labeled sections (PURPOSE, USAGE, BEHAVIOR, RETURNS) and provides comprehensive information. While slightly verbose, every sentence adds value. It could be trimmed slightly without losing clarity, but overall it's efficient for its depth.

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

Completeness5/5

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

Given no output schema and no annotations, the description covers all necessary context: return format, error conditions, async behavior, and usage scenarios. It is complete for an agent to select and invoke this tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Although the input schema already includes descriptions for all three parameters (100% coverage), the description adds meaningful context: typical frames values (2-4 for tap, higher for held movement), release_frames purpose (avoid debounce), and case sensitivity for button names. This enriches understanding beyond schema.

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 tool appends a button-press to the input FIFO, specifying hold and release frames. It distinguishes itself from mgba_advance_frames by noting the latter advances emulation without queueing inputs. The purpose is precise and unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage guidance: use to drive games with input, explains that consecutive calls produce distinct edge events, and advises on sending two presses for reliable double-tap. It also tells when to use alternatives: mgba_advance_frames for manual advance, and mgba_pause for inspecting side effects.

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/dmang-dev/mcp-mgba'

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