Skip to main content
Glama
rishabkoul
by rishabkoul

read-output

Retrieve text output from a specific iTerm2 terminal session to access command results or displayed content.

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 retrieves the terminal by ID from the global 'terminals' map, joins its output buffer into a string, clears the buffer, and returns the output as text content or a not-found message.
    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",
          },
        ],
      };
    }
  • Zod input schema for the tool, defining 'terminalId' as a required string parameter.
    {
      terminalId: z.string().describe("ID of the terminal to read output from"),
    },
  • index.js:160-191 (registration)
    Complete 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",
            },
          ],
        };
      }
    );
  • index.js:9-11 (helper)
    Global state management: Map to store active terminals (with processes and output arrays) and counter for unique IDs, essential for the read-output functionality.
    // Store active terminals
    const terminals = new Map();
    let terminalCounter = 0;
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('read') but doesn't clarify whether this is a read-only operation, what permissions are required, how output is formatted (e.g., text stream, structured data), or if there are side effects (e.g., clearing the terminal buffer). This leaves significant gaps for a tool interacting with terminal output.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, direct sentence with zero wasted words. It front-loads the core action and resource, making it highly efficient and easy to parse. Every word earns its place, achieving optimal conciseness for this simple tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of terminal operations and the lack of annotations or output schema, the description is incomplete. It doesn't explain what 'output' entails (e.g., recent lines, full buffer, real-time stream), return format, error conditions, or dependencies on other tools like 'open-terminal'. For a tool with no structured behavioral hints, this leaves too much undefined.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the single parameter 'terminalId' clearly documented in the schema. The description adds no additional parameter semantics beyond what the schema provides, such as format examples or constraints. Since the schema does the heavy lifting, the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('read') and target resource ('output from a specific terminal'), making the purpose immediately understandable. However, it doesn't differentiate itself from sibling tools like 'list-terminals' or 'execute-command' in terms of scope or specific use case, which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'list-terminals' (which might show terminal status) or 'execute-command' (which might produce output). There's no mention of prerequisites (e.g., needing an open terminal) or exclusions, leaving the agent to infer usage context from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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