Skip to main content
Glama
simen
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 ), }, ], }; }

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