Skip to main content
Glama

pine_load_state

Load a previously-saved emulator state from a numbered save slot (0-255).

Instructions

Trigger the emulator to load a previously-saved state from a numbered slot.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
slotYesSave state slot (0-255)

Implementation Reference

  • Handler for the pine_load_state tool. Calls pine.loadState(slot) and returns a confirmation message.
    case "pine_load_state": {
      await pine.loadState(p.slot as number);
      return ok(`Load state triggered for slot ${p.slot}`);
    }
  • Input schema definition for the pine_load_state tool. Requires a 'slot' integer (0-255).
    {
      name: "pine_load_state",
      description: "Trigger the emulator to load a previously-saved state from a numbered slot.",
      inputSchema: {
        type: "object",
        required: ["slot"],
        properties: {
          slot: { type: "integer", minimum: 0, maximum: 255, description: "Save state slot (0-255)" },
        },
      },
    },
  • src/tools.ts:174-250 (registration)
    The tool is registered via setRequestHandler(CallToolRequestSchema) inside the registerTools() function. The switch/case dispatches to the pine_load_state handler on line 241.
      server.setRequestHandler(CallToolRequestSchema, async (req) => {
        const { name, arguments: args = {} } = req.params;
        const p = args as Record<string, unknown>;
        const addr = () => p.address as number;
    
        switch (name) {
          case "pine_ping": {
            const v = await pine.getVersion();
            return ok(`OK — emulator: ${v}`);
          }
    
          case "pine_get_info": {
            const [title, id, uuid, gameVer, status] = await Promise.all([
              pine.getTitle().catch(() => "(unavailable)"),
              pine.getId().catch(() => "(unavailable)"),
              pine.getUuid().catch(() => "(unavailable)"),
              pine.getGameVersion().catch(() => "(unavailable)"),
              pine.getStatus(),
            ]);
            return ok(
              `Title:        ${title}\n` +
              `Serial:       ${id}\n` +
              `Disc CRC:     ${uuid}\n` +
              `Game version: ${gameVer}\n` +
              `Status:       ${status}`,
            );
          }
    
          case "pine_get_status": {
            return ok(`Status: ${await pine.getStatus()}`);
          }
    
          case "pine_read8":  return ok(`${addrHex(addr())}: ${fmtHex(await pine.read8(addr()))}`);
          case "pine_read16": return ok(`${addrHex(addr())}: ${fmtHex(await pine.read16(addr()))}`);
          case "pine_read32": return ok(`${addrHex(addr())}: ${fmtHex(await pine.read32(addr()))}`);
          case "pine_read64": return ok(`${addrHex(addr())}: ${fmtHex(await pine.read64(addr()))}`);
    
          case "pine_write8": {
            await pine.write8(addr(), p.value as number);
            return ok(`Wrote ${fmtHex(p.value as number)} → ${addrHex(addr())}`);
          }
          case "pine_write16": {
            await pine.write16(addr(), p.value as number);
            return ok(`Wrote ${fmtHex(p.value as number)} → ${addrHex(addr())}`);
          }
          case "pine_write32": {
            await pine.write32(addr(), p.value as number);
            return ok(`Wrote ${fmtHex(p.value as number)} → ${addrHex(addr())}`);
          }
          case "pine_write64": {
            const v = BigInt(p.value as string);
            await pine.write64(addr(), v);
            return ok(`Wrote ${fmtHex(v)} → ${addrHex(addr())}`);
          }
    
          case "pine_read_range": {
            const bytes = await pine.readRange(p.address as number, p.length as number);
            const hex = Array.from(bytes)
              .map((b) => b.toString(16).padStart(2, "0").toUpperCase())
              .join(" ");
            return ok(`${addrHex(p.address as number)} [${bytes.length} bytes]:\n${hex}`);
          }
    
          case "pine_save_state": {
            await pine.saveState(p.slot as number);
            return ok(`Save state triggered for slot ${p.slot}`);
          }
          case "pine_load_state": {
            await pine.loadState(p.slot as number);
            return ok(`Load state triggered for slot ${p.slot}`);
          }
    
          default:
            throw new Error(`Unknown tool: ${name}`);
        }
      });
    }
  • Low-level helper on PineClient that sends the LoadState opcode (0x0A) with the slot number as a single byte argument.
    async loadState(slot: number): Promise<void> {
      const args = Buffer.alloc(1); args.writeUInt8(slot, 0);
      await this.call(Op.LoadState, args);
    }
Behavior3/5

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

With no annotations, the description carries the burden. It states the tool triggers the emulator to load a state, implying mutation. However, it lacks details on side effects (e.g., unsaved changes lost) or error scenarios (e.g., invalid slot).

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 concise sentence (14 words) that is front-loaded with the action 'Trigger the emulator'. Every word is necessary and earns its place.

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

Completeness4/5

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

For a simple tool with one parameter and no output schema, the description covers the purpose and parameter adequately. It lacks mention of return values or behavior on invalid slot, but overall it is reasonably complete.

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?

The schema covers the parameter 'slot' with description, and the tool description adds context that it loads a previously-saved state. Since schema_description_coverage is 100%, baseline is 3; description does not add significant meaning.

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 loads a previously-saved state from a numbered slot, specifying the verb 'load' and resource 'emulator state'. It distinguishes from sibling 'pine_save_state' by being the opposite operation.

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

Usage Guidelines3/5

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

The description implies usage without explicit guidance. It does not specify when to use this tool vs alternatives like 'pine_save_state', nor does it provide prerequisites or conditions for use.

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-pine'

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