Skip to main content
Glama
simen

VICE C64 Emulator MCP Server

by simen

saveSnapshot

Save the complete Commodore 64 emulator state to a file for debugging, creating restore points, or sharing exact machine configurations.

Instructions

Save the complete machine state to a file.

Creates a VICE snapshot file containing:

  • All memory (RAM, I/O states)

  • CPU registers

  • VIC-II, SID, CIA states

  • Disk drive state (if attached)

Use to:

  • Save state before risky debugging

  • Create restore points

  • Share exact machine state

Related tools: loadSnapshot

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameYesFilename for the snapshot (e.g., 'debug-state.vsf')

Implementation Reference

  • src/index.ts:944-978 (registration)
    MCP server registration of the 'saveSnapshot' tool, including full description, Zod input schema requiring a filename string, and the handler function.
    server.registerTool(
      "saveSnapshot",
      {
        description: `Save the complete machine state to a file.
    
    Creates a VICE snapshot file containing:
    - All memory (RAM, I/O states)
    - CPU registers
    - VIC-II, SID, CIA states
    - Disk drive state (if attached)
    
    Use to:
    - Save state before risky debugging
    - Create restore points
    - Share exact machine state
    
    Related tools: loadSnapshot`,
        inputSchema: z.object({
          filename: z.string().describe("Filename for the snapshot (e.g., 'debug-state.vsf')"),
        }),
      },
      async (args) => {
        try {
          await client.saveSnapshot(args.filename);
          return formatResponse({
            success: true,
            filename: args.filename,
            message: `Snapshot saved to ${args.filename}`,
            hint: "Use loadSnapshot() to restore this state later",
          });
        } catch (error) {
          return formatError(error as ViceError);
        }
      }
    );
  • The handler function for the saveSnapshot MCP tool. It takes the filename argument, calls the underlying ViceClient.saveSnapshot method, formats success/error responses with metadata.
    async (args) => {
      try {
        await client.saveSnapshot(args.filename);
        return formatResponse({
          success: true,
          filename: args.filename,
          message: `Snapshot saved to ${args.filename}`,
          hint: "Use loadSnapshot() to restore this state later",
        });
      } catch (error) {
        return formatError(error as ViceError);
      }
    }
  • Zod input schema validation for the saveSnapshot tool, requiring a single 'filename' string parameter.
    inputSchema: z.object({
      filename: z.string().describe("Filename for the snapshot (e.g., 'debug-state.vsf')"),
    }),
  • ViceClient helper method that implements the snapshot save by encoding the filename length-prefixed buffer and sending the VICE 'Dump' command over the protocol.
    async saveSnapshot(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.Dump, 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