terminal_stop
Stop an active terminal session managed by the Electron Terminal MCP Server using the specified session ID, ensuring proper session termination and resource cleanup.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sessionId | Yes |
Implementation Reference
- index.js:360-384 (registration)Registers the 'terminal_stop' MCP tool. Input schema requires a sessionId string. The handler checks if the server is running (starts Electron if not), then sends a POST request to the API endpoint `/stop/{sessionId}` to stop the terminal session, returning the result message and exit code.server.tool( "terminal_stop", { sessionId: z.string() }, async ({ sessionId }) => { try { // Check if server is running, start if not if (!(await isServerRunning())) { await startElectronProcess(); } const response = await axios.post(`${apiBaseUrl}/stop/${sessionId}`); const result = response.data; return { content: [{ type: "text", text: `Session ID: ${result.sessionId}\n\n ${result.message}`, exitCode: result.exitCode }] }; } catch (error) { return formatErrorResponse(error, sessionId); } } );
- index.js:365-383 (handler)Handler function for 'terminal_stop' tool: ensures server is running, POSTs to API to stop session, formats response or error.async ({ sessionId }) => { try { // Check if server is running, start if not if (!(await isServerRunning())) { await startElectronProcess(); } const response = await axios.post(`${apiBaseUrl}/stop/${sessionId}`); const result = response.data; return { content: [{ type: "text", text: `Session ID: ${result.sessionId}\n\n ${result.message}`, exitCode: result.exitCode }] }; } catch (error) { return formatErrorResponse(error, sessionId); } }
- index.js:362-364 (schema)Input schema for 'terminal_stop' tool using Zod: requires 'sessionId' as string.{ sessionId: z.string() },