Skip to main content
Glama

mgba_load_state

Restore emulator state from a save slot or .ss file to undo changes or jump to a bookmarked state.

Instructions

PURPOSE: Restore the emulator from a previously saved slot or .ss state file. USAGE: Counterpart to mgba_save_state. Use to undo a sequence of writes/inputs (the snapshot/experiment/restore workflow), to jump to a bookmarked game state, or to start each tool-call sequence from a known baseline. EXACTLY ONE of slot or path must be supplied (passing both, or neither, returns an error). To start fresh from console boot instead of a snapshot, use mgba_reset. BEHAVIOR: DESTRUCTIVE TO LIVE STATE: replaces ALL current emulator state (RAM, registers, mapper, audio, frame count, in-flight DMA) with the snapshot's contents. Anything not previously snapshotted is lost (unsaved in-game progress, queued button presses, paused state). The state file/slot MUST come from the same ROM and a compatible mGBA version that produced it — loading mismatched data typically produces a corrupt run or a hard error. Returns an error if neither slot nor path is supplied, the file doesn't exist or isn't a valid mGBA state, the slot is empty or out of range, or the relevant bridge load-state method (loadStateSlot vs loadStateFile) is missing on this build (check capabilities in mgba_get_info). RETURNS: Single line 'Loaded state from PATH' or 'Loaded state from slot N' depending on which form you used.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
slotNoSave state slot number (0-9) to load. Mutually exclusive with `path` — supply exactly one. Loading an empty slot returns an error. Out-of-range slot numbers return an error.
pathNoAbsolute filesystem path to an existing .ss state file produced by mgba_save_state (or mGBA's UI) on this same ROM and a compatible mGBA version. Mutually exclusive with `slot` — supply exactly one. Loading mismatched files typically produces a corrupt run or a hard error. Only works on mGBA builds that expose the loadStateFile capability.
Behavior5/5

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

No annotations exist, so description carries full burden. Discloses destructive nature ('replaces ALL current emulator state'), lists what is lost (RAM, registers, etc.), and warns about compatibility issues with mismatched ROM/version. Covers error conditions and return format.

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?

Well-structured with labeled sections (PURPOSE, USAGE, BEHAVIOR, RETURNS). Every sentence adds value, though slightly lengthy due to comprehensive detail. Nearly optimal for the information density required.

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?

For a tool with 2 params, no output schema, and no annotations, the description covers all necessary aspects: purpose, usage context, behavioral side effects, parameter constraints, error handling, and return values. No gaps identified.

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?

Input schema has 100% coverage, so baseline is 3. Description adds significant value: clarifies mutual exclusivity, error cases for empty slot/out-of-range, and compatibility details for path. This goes well beyond the schema descriptions.

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?

Clearly states 'Restore the emulator from a previously saved slot or .ss state file.' Distinguishes from sibling mgba_reset (start fresh) and identifies as counterpart to mgba_save_state. Verb+resource+scope is specific.

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?

Explicitly lists use cases (undo writes, jump to bookmark, start from baseline) and alternative mgba_reset for fresh start. Also specifies that exactly one of slot/path must be supplied, providing clear when-to and when-not-to guidance.

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