terminal_get_output
Retrieve command output from a terminal session in an Electron application. Use the session ID to fetch results programmatically for automation or integration.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sessionId | Yes |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"sessionId": {
"type": "string"
}
},
"required": [
"sessionId"
],
"type": "object"
}
Implementation Reference
- index.js:331-357 (handler)Handler function for the 'terminal_get_output' MCP tool. It retrieves terminal output for a given session ID by calling the Electron backend API at /output/{sessionId}, strips ANSI codes, and returns the formatted output.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); } } );
- index.js:333-335 (schema)Input schema for the 'terminal_get_output' tool, requiring a sessionId string.{ sessionId: z.string() },
- index.js:331-332 (registration)Registration of the 'terminal_get_output' tool using server.tool.server.tool( "terminal_get_output",