Skip to main content
Glama

mgba_save_state

Save the full emulator state to a numbered slot or file path for rollback, bookmarking, or sharing replay states.

Instructions

PURPOSE: Save the entire emulator state (RAM, CPU/PPU/APU registers, mapper state, sound chip state, timing, in-flight DMA) to either an mGBA-managed numbered slot OR an arbitrary file path. USAGE: Use as a rollback point before risky writes, to bookmark interesting game states, to share repro states, or — on Game Boy — to seed cartridge SRAM cleanly without fighting MBC bus semantics that mgba_write* would bypass. EXACTLY ONE of slot or path must be supplied (passing both, or neither, returns an error). Slots 0-9 are managed by mGBA in its data directory and are ideal for ad-hoc rollback during a session; explicit paths are better for long-term storage and sharing across sessions/machines. The companion mgba_load_state restores from either form. BEHAVIOR: When path is supplied, DESTRUCTIVE TO TARGET FILE: overwrites the file at path if it exists, with no prompt or backup. When slot is supplied, DESTRUCTIVE TO THE NAMED SLOT: overwrites whatever was previously stored in that slot. The state is bound to the EXACT ROM and a compatible mGBA version that produced it — loading it on a different ROM or an incompatible mGBA version typically produces a corrupt run or a hard error. Returns an error if neither slot nor path is supplied, the path's parent directory doesn't exist, the path isn't writable, the slot is out of range, or the relevant bridge save-state method (saveStateSlot vs saveStateFile) is missing on this build (check capabilities in mgba_get_info). RETURNS: Single line 'Saved state to PATH' or 'Saved state to slot N' depending on which form you used.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
slotNoSave state slot number (0-9). Slot files are managed by mGBA in its data directory. Mutually exclusive with `path` — supply exactly one. Out-of-range slot numbers return an error.
pathNoAbsolute filesystem path to write the state to (e.g. C:/temp/checkpoint.ss0 on Windows, /tmp/checkpoint.ss0 on Linux/macOS). Mutually exclusive with `slot` — supply exactly one. Parent directory must exist; file is overwritten without prompt if present. Only works on mGBA builds that expose the saveStateFile capability.
Behavior5/5

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

With no annotations, the description fully discloses destructive behavior (overwrites without prompt), state version binding to ROM and mGBA version, and error conditions. No contradictions.

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 somewhat lengthy but well-structured with clear labeled sections. Every sentence adds value, though minor trimming could improve conciseness.

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, the description explains return values and all relevant error scenarios. It covers the tool's full context, including limitations and prerequisites, making it self-contained.

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?

Schema has 100% coverage with descriptions for both parameters. The description adds meaningful context: slot management by mGBA, path requirements (absolute, parent directory must exist), and capability dependency.

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 explicitly states 'Save the entire emulator state' and enumerates exactly what is saved (RAM, CPU/PPU/APU registers, etc.). It clearly distinguishes between the two invocation modes (slot vs path) and contrasts with sibling tools like mgba_load_state.

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?

Provides explicit usage scenarios: rollback point, bookmarking, sharing, seeding SRAM. Clearly states the mutual exclusivity of arguments and advises when to use slots vs paths. References the companion tool mgba_load_state.

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