Skip to main content
Glama

read-output

Retrieve terminal output using the terminal ID to monitor or process session results in iTerm2 via the MCP server.

Instructions

Read the output from a specific terminal

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
terminalIdYesID of the terminal to read output from

Implementation Reference

  • The handler function that executes the logic for the 'read-output' tool. It fetches the terminal by ID, retrieves and clears its output buffer, and returns the output as structured content or an error message if the terminal is not found.
    async ({ terminalId }) => { const terminal = terminals.get(terminalId); if (!terminal) { return { content: [ { type: "text", text: `Terminal ${terminalId} not found`, }, ], }; } const output = terminal.output.join(""); terminal.output.length = 0; // Clear the output buffer return { content: [ { type: "text", text: output || "No output available", }, ], }; }
  • The input schema for the 'read-output' tool, specifying the required 'terminalId' parameter as a string using Zod validation.
    { terminalId: z.string().describe("ID of the terminal to read output from"), },
  • index.js:160-191 (registration)
    The registration of the 'read-output' tool using server.tool(), including name, description, schema, and handler function.
    server.tool( "read-output", "Read the output from a specific terminal", { terminalId: z.string().describe("ID of the terminal to read output from"), }, async ({ terminalId }) => { const terminal = terminals.get(terminalId); if (!terminal) { return { content: [ { type: "text", text: `Terminal ${terminalId} not found`, }, ], }; } const output = terminal.output.join(""); terminal.output.length = 0; // Clear the output buffer return { content: [ { type: "text", text: output || "No output available", }, ], }; } );

Other Tools

Related Tools

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/rishabkoul/iTerm-MCP-Server'

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