terminal_get_sessions
Retrieve active terminal sessions from an Electron-based terminal server to manage and monitor command execution programmatically.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.js:388-410 (registration)Registers the 'terminal_get_sessions' MCP tool with an inline handler function that checks if the server is running, starts the Electron process if needed, fetches active terminal sessions from the API endpoint `/sessions`, and returns the list of sessions as formatted JSON text.server.tool( "terminal_get_sessions", {}, async () => { try { // Check if server is running, start if not if (!(await isServerRunning())) { await startElectronProcess(); } const response = await axios.get(`${apiBaseUrl}/sessions`); const result = response.data; return { content: [{ type: "text", text: `Active sessions:\n\n ${JSON.stringify(result, null, 2)}`, exitCode: 0 }] }; } catch (error) { return formatErrorResponse(error); } } );
- index.js:391-409 (handler)The handler function for the 'terminal_get_sessions' tool. It ensures the Electron server is running, retrieves active sessions via API, and formats the response as text content with session list in JSON.async () => { try { // Check if server is running, start if not if (!(await isServerRunning())) { await startElectronProcess(); } const response = await axios.get(`${apiBaseUrl}/sessions`); const result = response.data; return { content: [{ type: "text", text: `Active sessions:\n\n ${JSON.stringify(result, null, 2)}`, exitCode: 0 }] }; } catch (error) { return formatErrorResponse(error); } }
- index.js:390-390 (schema)Empty schema indicating the tool takes no input parameters.{},