Skip to main content
Glama
simen

VICE C64 Emulator MCP Server

by simen

loadProgram

Load and run Commodore 64 program files (PRG, D64, T64 formats) into the VICE emulator for debugging and execution.

Instructions

Load and optionally run a program file.

Supports PRG, D64, T64, and other C64 file formats. For disk images, can specify which file to run.

Options:

  • run: If true (default), starts execution after loading

  • fileIndex: For disk images, which file to load (0 = first)

Related tools: reset, status, setBreakpoint

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameYesPath to the program file (PRG, D64, T64, etc.)
runNoRun after loading (default: true)
fileIndexNoFile index in disk image (default: 0)

Implementation Reference

  • src/index.ts:1011-1046 (registration)
    MCP tool registration for 'loadProgram', including Zod input schema, description, and handler function that delegates to ViceClient.autostart and formats the response.
    server.registerTool(
      "loadProgram",
      {
        description: `Load and optionally run a program file.
    
    Supports PRG, D64, T64, and other C64 file formats.
    For disk images, can specify which file to run.
    
    Options:
    - run: If true (default), starts execution after loading
    - fileIndex: For disk images, which file to load (0 = first)
    
    Related tools: reset, status, setBreakpoint`,
        inputSchema: z.object({
          filename: z.string().describe("Path to the program file (PRG, D64, T64, etc.)"),
          run: z.boolean().optional().describe("Run after loading (default: true)"),
          fileIndex: z.number().optional().describe("File index in disk image (default: 0)"),
        }),
      },
      async (args) => {
        try {
          await client.autostart(args.filename, args.fileIndex ?? 0, args.run ?? true);
          return formatResponse({
            success: true,
            filename: args.filename,
            run: args.run ?? true,
            message: `Loading ${args.filename}${args.run !== false ? " and running" : ""}`,
            hint: args.run !== false
              ? "Program is loading. Set breakpoints before it reaches your code of interest."
              : "Program loaded but not started. Use continue() to run.",
          });
        } catch (error) {
          return formatError(error as ViceError);
        }
      }
    );
  • Core implementation of program loading via VICE Binary Monitor Protocol's AutoStart command. Constructs the protocol body (run flag, file index, filename) and sends it to VICE.
    async autostart(filename: string, fileIndex = 0, runAfterLoad = true): Promise<void> {
      const filenameBuffer = Buffer.from(filename, "utf8");
      // Body: run(1) + index(2) + filename_length(1) + filename
      const body = Buffer.alloc(4 + filenameBuffer.length);
      body[0] = runAfterLoad ? 1 : 0;
      body.writeUInt16LE(fileIndex, 1);
      body[3] = filenameBuffer.length;
      filenameBuffer.copy(body, 4);
      await this.sendCommand(Command.AutoStart, body);
    }
  • Zod input schema defining parameters for the loadProgram tool: filename (required), run (optional boolean), fileIndex (optional number).
      filename: z.string().describe("Path to the program file (PRG, D64, T64, etc.)"),
      run: z.boolean().optional().describe("Run after loading (default: true)"),
      fileIndex: z.number().optional().describe("File index in disk image (default: 0)"),
    }),
  • Factory function providing the singleton ViceClient instance used by the loadProgram handler.
    export function getViceClient(): ViceClient {
      if (!clientInstance) {
        clientInstance = new ViceClient();
      }
      return clientInstance;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions that the tool 'Supports PRG, D64, T64, and other C64 file formats' and 'For disk images, can specify which file to run,' which adds some context. However, it fails to disclose critical behavioral traits such as whether loading overwrites existing memory, what happens on errors, or if there are rate limits or authentication needs. This leaves significant gaps for a mutation tool.

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 appropriately sized and front-loaded, starting with the core purpose. The bullet points for options are efficient, and the related tools section is concise. However, the inclusion of 'Related tools' could be seen as slightly extraneous if not integrated into usage guidelines, but overall, it remains well-structured with minimal waste.

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

Completeness2/5

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

Given the complexity of a tool that loads and runs programs (a mutation operation), the lack of annotations and output schema means the description should compensate more. It does not explain return values, error handling, or side effects (e.g., memory changes). While it covers basic functionality, it is incomplete for safe and effective use by an AI agent in this context.

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 input schema has 100% description coverage, so the schema already documents all parameters (filename, run, fileIndex). The description adds minimal value beyond the schema by listing options in a bullet-point format but does not provide additional semantics, syntax, or format details. This meets the baseline score of 3 when schema coverage is high.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Load and optionally run a program file.' It specifies the verb ('load' and optionally 'run') and resource ('program file'), and mentions supported formats (PRG, D64, T64, etc.). However, it does not explicitly distinguish this tool from its siblings (e.g., 'loadSnapshot' or 'readMemory'), which would be needed for a score of 5.

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 provides implied usage guidance by listing 'Related tools: reset, status, setBreakpoint,' suggesting contexts where this tool might be used in conjunction with others. However, it lacks explicit instructions on when to use this tool versus alternatives (e.g., 'loadSnapshot' for saved states or 'readMemory' for direct memory access), and does not specify prerequisites or exclusions, keeping it at a moderate score.

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

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