Skip to main content
Glama
dylan-gluck

MCP Background Job Server

by dylan-gluck

get_job_status

Check the current status of a background job by providing its UUID to monitor progress and determine if it's running, completed, failed, or killed.

Instructions

Get the current status of a background job.

Args: job_id: The UUID of the job to check

Returns: The current status of the job (running, completed, failed, or killed)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
job_idYesJob ID to check

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
statusYesCurrent job status

Implementation Reference

  • FastMCP tool handler implementation for 'get_job_status'. Calls JobManager.get_job_status(job_id) and returns StatusOutput(status=job_status), handling errors with ToolError.
    @mcp.tool()
    async def get_job_status(
        job_id: str = Field(..., description="Job ID to check"),
    ) -> StatusOutput:
        """Get the current status of a background job.
    
        Args:
            job_id: The UUID of the job to check
    
        Returns:
            The current status of the job (running, completed, failed, or killed)
        """
        try:
            job_manager = get_job_manager()
            job_status = await job_manager.get_job_status(job_id)
            return StatusOutput(status=job_status)
        except KeyError:
            raise ToolError(f"Job {job_id} not found")
        except Exception as e:
            logger.error(f"Error getting job status for {job_id}: {e}")
            raise ToolError(f"Failed to get job status: {str(e)}")
  • Pydantic BaseModel StatusOutput defining the output schema: status: JobStatus.
    class StatusOutput(BaseModel):
        """Output from status tool."""
    
        status: JobStatus = Field(..., description="Current job status")
  • JobStatus enum defining possible job status values used in StatusOutput.
    class JobStatus(str, Enum):
        """Status of a background job."""
    
        RUNNING = "running"
        COMPLETED = "completed"
        FAILED = "failed"
        KILLED = "killed"
  • JobManager.get_job_status method providing core logic: checks job existence, updates status via _update_job_status, returns current status.
    async def get_job_status(self, job_id: str) -> JobStatus:
        """Get current status of job.
    
        Args:
            job_id: Job identifier
    
        Returns:
            Current job status
    
        Raises:
            KeyError: If job_id doesn't exist
        """
        if job_id not in self._jobs:
            raise KeyError(f"Job {job_id} not found")
    
        # Update job status from process
        await self._update_job_status(job_id)
    
        return self._jobs[job_id].status
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses that this is a read operation (checking status) and lists possible status values (running, completed, failed, killed), which helps understand behavior. However, it lacks details on permissions, rate limits, or error handling, which are important for a job status tool.

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, followed by clear 'Args' and 'Returns' sections. Every sentence is necessary and contributes to understanding, with no wasted words, making it highly efficient.

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 (implied by 'Returns' section), the description is mostly complete. It covers the purpose, parameter, and return values adequately. However, it could improve by addressing usage relative to siblings or adding behavioral details like error cases.

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 specifying it as a 'UUID', which clarifies the format beyond just 'string'. This slight enhancement justifies a score above the baseline of 3.

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 the current status') and resource ('a background job'), distinguishing it from siblings like 'get_job_output' (which retrieves output) or 'kill_job' (which terminates jobs). It precisely defines the tool's function without ambiguity.

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 needing to check job status, but does not explicitly state when to use this tool versus alternatives like 'list_jobs' (for overview) or 'tail_job_output' (for real-time monitoring). No exclusions or prerequisites are mentioned, leaving some context gaps.

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