Skip to main content
Glama
simen

VICE C64 Emulator MCP Server

by simen

loadSnapshot

Restore a previously saved C64 emulator state from a file to resume debugging or gameplay exactly where you left off.

Instructions

Load a previously saved machine state from a file.

Restores complete machine state including memory, registers, and peripheral states.

Warning: This completely replaces the current state!

Related tools: saveSnapshot

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameYesFilename of the snapshot to load

Implementation Reference

  • MCP tool handler for 'loadSnapshot' that extracts filename argument, calls ViceClient.loadSnapshot, and formats success/error response with metadata.
      async (args) => {
        try {
          await client.loadSnapshot(args.filename);
          return formatResponse({
            success: true,
            filename: args.filename,
            message: `Snapshot loaded from ${args.filename}`,
            hint: "Machine state restored. Use getRegisters() to verify state.",
          });
        } catch (error) {
          return formatError(error as ViceError);
        }
      }
    );
  • Input schema and description for the 'loadSnapshot' tool, requiring a 'filename' string parameter.
      {
        description: `Load a previously saved machine state from a file.
    
    Restores complete machine state including memory, registers, and peripheral states.
    
    Warning: This completely replaces the current state!
    
    Related tools: saveSnapshot`,
        inputSchema: z.object({
          filename: z.string().describe("Filename of the snapshot to load"),
        }),
      },
  • src/index.ts:981-1008 (registration)
    Registration of the 'loadSnapshot' MCP tool using McpServer.registerTool, including schema, description, and handler.
    server.registerTool(
      "loadSnapshot",
      {
        description: `Load a previously saved machine state from a file.
    
    Restores complete machine state including memory, registers, and peripheral states.
    
    Warning: This completely replaces the current state!
    
    Related tools: saveSnapshot`,
        inputSchema: z.object({
          filename: z.string().describe("Filename of the snapshot to load"),
        }),
      },
      async (args) => {
        try {
          await client.loadSnapshot(args.filename);
          return formatResponse({
            success: true,
            filename: args.filename,
            message: `Snapshot loaded from ${args.filename}`,
            hint: "Machine state restored. Use getRegisters() to verify state.",
          });
        } catch (error) {
          return formatError(error as ViceError);
        }
      }
    );
  • ViceClient.loadSnapshot helper method that encodes the filename and sends the VICE 'Undump' binary monitor command to load the snapshot.
    async loadSnapshot(filename: string): Promise<void> {
      const filenameBuffer = Buffer.from(filename, "utf8");
      const body = Buffer.alloc(1 + filenameBuffer.length);
      body[0] = filenameBuffer.length;
      filenameBuffer.copy(body, 1);
      await this.sendCommand(Command.Undump, body);
    }

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/simen/vice-mcp'

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