Skip to main content
Glama

read_output

Retrieve real-time output from a terminal session by specifying the process ID, enabling monitoring and management of active commands on Desktop Commander MCP.

Instructions

Read new output from a running terminal session.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pidYes

Implementation Reference

  • The core handler function that implements the read_output tool logic. It validates input args using the schema, retrieves new output for the specified PID from the terminal manager, and returns formatted MCP content.
    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 schema defining the input arguments for the read_output tool, which requires a 'pid' as a number.
    export const ReadOutputArgsSchema = z.object({ pid: z.number(), });
  • src/server.ts:67-71 (registration)
    Tool registration in the MCP server's list of tools, specifying the name, description, and input schema for read_output.
    name: "read_output", description: "Read new output from a running terminal session.", inputSchema: zodToJsonSchema(ReadOutputArgsSchema), },
  • src/server.ts:220-223 (registration)
    Dispatch handler in the MCP server's CallToolRequest handler that routes read_output calls to the readOutput function after parsing args.
    case "read_output": { const parsed = ReadOutputArgsSchema.parse(args); return readOutput(parsed); }

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/MrGNSS/ClaudeDesktopCommander'

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