Skip to main content
Glama
nexon33

Electron Terminal MCP Server

terminal_get_output

Retrieve output from a terminal session in an Electron application to access command results programmatically.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYes

Implementation Reference

  • index.js:331-358 (registration)
    Registration of the 'terminal_get_output' MCP tool, including input schema (sessionId: string) and inline handler function that fetches terminal output from the Electron backend API, cleans it, and returns formatted content.
    server.tool( "terminal_get_output", { sessionId: z.string() }, async ({ sessionId }) => { try { // Check if server is running, start if not if (!(await isServerRunning())) { await startElectronProcess(); } const response = await axios.get(`${apiBaseUrl}/output/${sessionId}`); const result = response.data; // Clean up terminal output using strip-ansi const cleanOutput = stripAnsi(result.output); return { content: [{ type: "text", text: `Session ID: ${result.sessionId}\n\n ${cleanOutput}`, exitCode: result.exitCode }] }; } catch (error) { return formatErrorResponse(error, sessionId); } } );
  • Handler logic for 'terminal_get_output': Ensures Electron server is running, GETs output for sessionId from /output/{sessionId}, strips ANSI, formats response with session ID and exit code, handles errors.
    try { // Check if server is running, start if not if (!(await isServerRunning())) { await startElectronProcess(); } const response = await axios.get(`${apiBaseUrl}/output/${sessionId}`); const result = response.data; // Clean up terminal output using strip-ansi const cleanOutput = stripAnsi(result.output); return { content: [{ type: "text", text: `Session ID: ${result.sessionId}\n\n ${cleanOutput}`, exitCode: result.exitCode }] }; } catch (error) { return formatErrorResponse(error, sessionId); } } );
  • Input schema for 'terminal_get_output' tool: requires a string sessionId.
    sessionId: z.string() }, async ({ sessionId }) => {

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