Skip to main content
Glama
simen

VICE C64 Emulator MCP Server

by simen

disconnect

Close the connection to the VICE C64 emulator instance to end debugging sessions and free resources.

Instructions

Disconnect from the VICE emulator instance.

Cleanly closes the connection. Safe to call even if not connected.

Related tools: connect, status

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:173-198 (registration)
    Registration of the 'disconnect' MCP tool, including its inline handler function that calls ViceClient.disconnect() and formats the response.
    server.registerTool(
      "disconnect",
      {
        description: `Disconnect from the VICE emulator instance.
    
    Cleanly closes the connection. Safe to call even if not connected.
    
    Related tools: connect, status`,
      },
      async () => {
        const wasConnected = client.getState().connected;
    
        try {
          await client.disconnect();
          return formatResponse({
            disconnected: true,
            wasConnected,
            message: wasConnected
              ? "Disconnected from VICE"
              : "Was not connected",
          });
        } catch (error) {
          return formatError(error as ViceError);
        }
      }
    );
  • The ViceClient.disconnect() method implementation, which closes the TCP socket connection to VICE and updates the connection state. This is called by the MCP tool handler.
    async disconnect(): Promise<void> {
      if (!this.socket) {
        return;
      }
    
      return new Promise((resolve) => {
        this.socket!.once("close", () => {
          this.state.connected = false;
          resolve();
        });
        this.socket!.end();
      });
    }
  • formatResponse helper function used by the disconnect tool handler to format the successful response with connection metadata.
    function formatResponse(data: object) {
      const state = client.getState();
      return {
        content: [
          {
            type: "text" as const,
            text: JSON.stringify(
              {
                ...data,
                _meta: {
                  connected: state.connected,
                  running: state.running,
                  ...(state.connected && { host: state.host, port: state.port }),
                },
              },
              null,
              2
            ),
          },
        ],
      };
    }
  • formatError helper function used by the disconnect tool handler to format error responses with connection metadata.
    function formatError(error: ViceError | Error) {
      const state = client.getState();
      const errorData =
        "code" in error
          ? error
          : {
              error: true,
              code: "UNKNOWN_ERROR",
              message: error.message,
            };
    
      return {
        content: [
          {
            type: "text" as const,
            text: JSON.stringify(
              {
                ...errorData,
                _meta: {
                  connected: state.connected,
                  running: state.running,
                },
              },
              null,
              2
            ),
          },
        ],
      };
    }
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing key behavioral traits: it performs a clean closure operation and is idempotent ('Safe to call even if not connected'). However, it doesn't mention potential side effects like whether this affects other tools or if reconnection is needed afterward.

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?

Perfectly front-loaded with the core purpose in the first sentence, followed by important behavioral context, and ending with related tools. Every sentence earns its place with zero wasted words, making it highly efficient and easy to parse.

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 zero-parameter tool with no annotations or output schema, the description provides complete context about what the tool does, when to use it, and its safety characteristics. The only minor gap is not explicitly mentioning what happens after disconnection or if there are any prerequisites, but given the simplicity of the operation, this is sufficient.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the baseline would be 4. The description appropriately doesn't add parameter information since none exist, maintaining focus on the tool's purpose and behavior without unnecessary details.

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 specific action ('Disconnect from the VICE emulator instance') and distinguishes it from siblings by specifying it's for connection termination rather than other emulator operations like 'connect', 'status', or memory operations. It goes beyond just restating the name by explaining what disconnecting means.

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 provides when to use ('Cleanly closes the connection') and when not to worry about using it ('Safe to call even if not connected'), plus explicitly names related alternatives ('connect, status'). This gives clear context for when this tool is appropriate versus other connection-related tools.

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