Skip to main content
Glama
dylan-gluck

MCP Background Job Server

by dylan-gluck

list_jobs

View all background jobs with their current status, command, and start time to monitor ongoing processes.

Instructions

List all background jobs with their status.

Returns a list of all background jobs, including their job ID, status, command, and start time. Jobs are sorted by start time (newest first).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
jobsYesList of all background jobs

Implementation Reference

  • MCP tool handler for 'list_jobs', decorated with @mcp.tool() which registers it. Calls JobManager.list_jobs() and returns ListOutput.
    @mcp.tool()
    async def list_jobs() -> ListOutput:
        """List all background jobs with their status.
    
        Returns a list of all background jobs, including their job ID, status,
        command, and start time. Jobs are sorted by start time (newest first).
        """
        try:
            job_manager = get_job_manager()
            jobs = await job_manager.list_jobs()
            return ListOutput(jobs=jobs)
        except Exception as e:
            logger.error(f"Error listing jobs: {e}")
            raise ToolError(f"Failed to list jobs: {str(e)}")
  • Pydantic model for the output schema of list_jobs tool, containing list of JobSummary.
    class ListOutput(BaseModel):
        """Output from list tool."""
    
        jobs: List[JobSummary] = Field(..., description="List of all background jobs")
  • Pydantic model for individual job summary used in ListOutput.
    class JobSummary(BaseModel):
        """Minimal job information for listing operations."""
    
        job_id: str = Field(..., description="UUID v4 job identifier")
        status: JobStatus = Field(..., description="Current job status")
        command: str = Field(..., description="Shell command being executed")
        started: datetime = Field(..., description="UTC timestamp when job started")
  • Core logic in JobManager service class that implements listing jobs: updates statuses, creates summaries, sorts by start time.
    async def list_jobs(self) -> List[JobSummary]:
        """List all jobs.
    
        Returns:
            List of JobSummary objects for all jobs
        """
        # Update all job statuses
        for job_id in list(self._jobs.keys()):
            try:
                await self._update_job_status(job_id)
            except Exception as e:
                logger.warning(f"Failed to update status for job {job_id}: {e}")
    
        # Create summaries
        summaries = []
        for job in self._jobs.values():
            summaries.append(
                JobSummary(
                    job_id=job.job_id,
                    status=job.status,
                    command=job.command,
                    started=job.started,
                )
            )
    
        # Sort by start time (newest first)
        summaries.sort(key=lambda x: x.started, reverse=True)
        return summaries
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 key behavioral traits: returns a list with specific fields (job ID, status, command, start time) and sorting by start time (newest first). However, it lacks details on pagination, rate limits, or error handling, which are relevant for a list operation.

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 front-loaded with the core purpose in the first sentence, followed by specific details in a second sentence. Every sentence adds value: the first defines the action, and the second clarifies output format and sorting. No wasted words.

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 (0 parameters, output schema exists), the description is mostly complete. It covers purpose, output fields, and sorting. However, with no annotations, it could benefit from mentioning any limitations (e.g., large result sets) or prerequisites, though the output schema may handle return values.

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 input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately adds no parameter information, focusing on output semantics instead. Baseline is 4 for zero parameters, as it avoids unnecessary details.

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 verb ('List') and resource ('all background jobs'), and distinguishes from siblings by focusing on comprehensive listing rather than individual job operations like get_job_status or kill_job. It specifies the scope includes all jobs with their status.

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

Usage Guidelines4/5

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

The description implies usage for viewing all jobs, which contrasts with siblings that target specific jobs (e.g., get_job_status, kill_job). However, it does not explicitly state when to use this tool versus alternatives like get_job_status for individual checks, leaving some ambiguity.

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