Skip to main content
Glama
abdessamad-elamrani

MalwareAnalyzerMCP

read_output

Retrieve output from running or completed processes during malware analysis to monitor execution results and gather forensic data.

Instructions

Read output from a running or completed process.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pidYesThe process ID to read output from

Implementation Reference

  • The core handler function readOutput(pid) that retrieves output from active or completed terminal sessions, formats completed output with exit code and runtime, and returns { output: string | null }.
    readOutput(pid) {
      // First check active sessions
      const session = this.sessions.get(pid);
      if (session) {
        const output = session.lastOutput;
        session.lastOutput = ''; // Clear the buffer after reading
        return { output };
      }
    
      // Then check completed sessions
      const completedSession = this.completedSessions.get(pid);
      if (completedSession) {
        // Format completion message with exit code and runtime
        const runtime = (completedSession.endTime.getTime() - completedSession.startTime.getTime()) / 1000;
        const outputStr = `Process completed with exit code ${completedSession.exitCode}\nRuntime: ${runtime.toFixed(2)}s\nFinal output:\n${completedSession.output}`;
        
        // Remove from completed sessions as we've delivered the final output
        this.completedSessions.delete(pid);
        
        return { output: outputStr };
      }
    
      // Return null if PID not found
      return { output: null };
    }
  • Zod schema defining the input parameters for the read_output tool: a required integer pid.
     * Schema for read_output tool
     * Defines parameters for reading process output
     */
    const readOutputSchema = z.object({
      pid: z.number().int().describe("The process ID to read output from")
    });
  • serverMCP.js:105-109 (registration)
    Registration of the read_output tool in the ListToolsRequestSchema handler, specifying name, description, and input schema.
    {
      name: 'read_output',
      description: 'Read output from a running or completed process.',
      inputSchema: zodToJsonSchema(readOutputSchema),
    },
  • MCP server request handler dispatch for 'read_output' tool, which validates input and delegates to terminalManager.readOutput.
    case 'read_output':
      try {
        // Type-check and validate arguments
        if (!args || typeof args.pid !== 'number') {
          return {
            content: [{ type: "text", text: "Error: Invalid PID parameter" }],
            isError: true,
          };
        }
        
        console.error(`Reading output for PID: ${args.pid}`);
        const result = terminalManager.readOutput(args.pid);
        return {
          content: [{ type: "text", text: JSON.stringify(result) }],
        };
      } catch (error) {
        console.error('Error reading output:', error);
        return {
          content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` }],
          isError: true,
        };
      }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action 'read output' but does not specify whether this is a read-only operation, if it requires specific permissions, what happens if the PID is invalid, or if there are rate limits. This leaves significant gaps in understanding the tool's behavior.

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, clear sentence that efficiently conveys the tool's purpose without any wasted words. It is appropriately sized and front-loaded, making it easy for an agent to parse quickly.

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 interacting with processes and no annotations or output schema, the description is incomplete. It lacks details on what the output looks like (e.g., text, binary), error handling, or how it differs from sibling tools, making it insufficient for full contextual understanding.

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 'pid' parameter clearly documented as 'The process ID to read output from'. The description adds no additional parameter details beyond what the schema provides, so it meets the baseline of 3 for high schema coverage without extra value.

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 verb 'read' and the resource 'output from a running or completed process', making the purpose specific and understandable. However, it does not explicitly distinguish this tool from sibling tools like 'file' or 'shell_command', which might also involve reading process output in some contexts, so it misses full sibling differentiation.

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. It does not mention any prerequisites, such as needing a valid PID, or compare it to siblings like 'shell_command' for command execution or 'file' for file reading, leaving the agent with no usage context.

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/abdessamad-elamrani/MalwareAnalyzerMCP'

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