Skip to main content
Glama
nexon33

Electron Terminal MCP Server

terminal_stop

Stop a terminal session in an Electron application by providing the session ID, allowing for clean termination of command execution processes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYes

Implementation Reference

  • index.js:360-384 (registration)
    Registration of the 'terminal_stop' MCP tool, including input schema (sessionId) and inline handler that proxies a stop request to the Electron backend API endpoint /stop/{sessionId}.
    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);
        }
      }
    );
  • The handler function for the terminal_stop tool. Ensures the Electron server is running, then sends a POST request to stop the specified terminal session and returns the result.
    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);
      }
    }
  • Input schema for terminal_stop tool, requiring a sessionId string.
    {
      sessionId: z.string()
    },

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/nexon33/console-terminal-mcp-server'

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