Skip to main content
Glama
StrawHatAI

Claude Desktop Commander MCP

by StrawHatAI

read_output

Retrieve terminal output from active processes to monitor command execution results in real-time.

Instructions

Read new output from a running terminal session.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pidYes

Implementation Reference

  • The core handler function for the 'read_output' tool. Parses input arguments using ReadOutputArgsSchema, retrieves new output from terminalManager.getNewOutput(pid), and returns formatted text content or error message if no session.
    export async function readOutput(args: unknown) {
      const parsed = ReadOutputArgsSchema.safeParse(args);
      if (!parsed.success) {
        throw new Error(`Invalid arguments for read_output: ${parsed.error}`);
      }
    
      const output = terminalManager.getNewOutput(parsed.data.pid);
      return {
        content: [{
          type: "text",
          text: output === null
            ? `No session found for PID ${parsed.data.pid}`
            : output || 'No new output available'
        }],
      };
    }
  • Zod input schema for 'read_output' tool requiring a single 'pid' property of type number.
    export const ReadOutputArgsSchema = z.object({
      pid: z.number(),
    });
  • src/server.ts:66-71 (registration)
    Tool specification registration in ListToolsRequestHandler, providing name, description, and JSON schema derived from ReadOutputArgsSchema.
    {
      name: "read_output",
      description:
        "Read new output from a running terminal session.",
      inputSchema: zodToJsonSchema(ReadOutputArgsSchema),
    },
  • src/server.ts:220-223 (registration)
    Dispatch case in CallToolRequestHandler that parses arguments with ReadOutputArgsSchema and invokes the readOutput handler function.
    case "read_output": {
      const parsed = ReadOutputArgsSchema.parse(args);
      return readOutput(parsed);
    }

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/StrawHatAI/claude-dev-tools'

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