Skip to main content
Glama
dylan-gluck

MCP Background Job Server

by dylan-gluck

get_job_output

Retrieve the complete stdout and stderr output from a background job by providing its job ID. This tool enables monitoring and analysis of command execution results.

Instructions

Get the complete stdout and stderr output of a job.

Args: job_id: The UUID of the job to get output from

Returns: ProcessOutput containing the complete stdout and stderr content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
job_idYesJob ID to get output from

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
stderrYesStandard error content
stdoutYesStandard output content

Implementation Reference

  • MCP tool handler for 'get_job_output', decorated with @mcp.tool(). Validates input with Pydantic Field, delegates to JobManager service, handles errors with ToolError.
    @mcp.tool()
    async def get_job_output(
        job_id: str = Field(..., description="Job ID to get output from"),
    ) -> ProcessOutput:
        """Get the complete stdout and stderr output of a job.
    
        Args:
            job_id: The UUID of the job to get output from
    
        Returns:
            ProcessOutput containing the complete stdout and stderr content
        """
        try:
            job_manager = get_job_manager()
            job_output = await job_manager.get_job_output(job_id)
            return job_output
        except KeyError:
            raise ToolError(f"Job {job_id} not found")
        except Exception as e:
            logger.error(f"Error getting job output for {job_id}: {e}")
            raise ToolError(f"Failed to get job output: {str(e)}")
  • Pydantic BaseModel defining the output schema for the tool, with stdout and stderr fields.
    class ProcessOutput(BaseModel):
        """Structured stdout/stderr output from a process."""
    
        stdout: str = Field(..., description="Standard output content")
        stderr: str = Field(..., description="Standard error content")
  • JobManager method implementing the core logic to fetch complete process output via ProcessWrapper for the specified job.
    async def get_job_output(self, job_id: str) -> ProcessOutput:
        """Get full stdout/stderr output.
    
        Args:
            job_id: Job identifier
    
        Returns:
            ProcessOutput with complete stdout and stderr
    
        Raises:
            KeyError: If job_id doesn't exist
        """
        if job_id not in self._jobs:
            raise KeyError(f"Job {job_id} not found")
    
        process_wrapper = self._processes.get(job_id)
        if process_wrapper is None:
            return ProcessOutput(stdout="", stderr="")
    
        return process_wrapper.get_output()
Behavior3/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. It discloses that the tool retrieves 'complete' output, which is a useful behavioral trait beyond basic functionality. However, it does not mention potential issues like large output handling, permissions required, or rate limits, leaving gaps in behavioral context.

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 well-structured and front-loaded with the core purpose in the first sentence. The Args and Returns sections are concise and directly relevant, with no wasted words. Every sentence earns its place by clarifying inputs and outputs efficiently.

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

Completeness4/5

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

Given the tool's low complexity (single parameter) and the presence of an output schema (Returns section), the description is mostly complete. It covers the purpose, input, and output, but lacks details on behavioral aspects like error handling or performance considerations, which could be useful despite the output schema.

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

Parameters4/5

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

The schema description coverage is 100%, so the schema already documents the job_id parameter. The description adds minimal value by restating the parameter in the Args section, but it does not provide additional semantics like format details or examples. With high schema coverage, the baseline is 3, but the explicit Args section slightly enhances clarity, warranting a 4.

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

Purpose5/5

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

The description clearly states the specific action ('Get') and resource ('complete stdout and stderr output of a job'), distinguishing it from siblings like get_job_status (which returns status, not output) and tail_job_output (which likely streams partial output). The verb+resource combination is precise and unambiguous.

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

Usage Guidelines3/5

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

The description implies usage when you need the full output of a job, but it does not explicitly state when to use this tool versus alternatives like tail_job_output (e.g., for streaming vs. complete output) or list_jobs (for job metadata). Guidelines are implied by the tool's purpose but lack explicit comparisons or exclusions.

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/dylan-gluck/mcp-background-job'

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