Skip to main content
Glama
bpamiri

CockroachDB MCP Server

by bpamiri

show_jobs

Monitor and filter background jobs in CockroachDB clusters by type, status, or quantity to track operations like backups, restores, and imports.

Instructions

Show background jobs in the cluster.

Args:
    job_type: Filter by job type (BACKUP, RESTORE, IMPORT, etc.).
    status: Filter by status (running, succeeded, failed, etc.).
    limit: Maximum jobs to return.

Returns:
    List of jobs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
job_typeNo
statusNo
limitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function that executes SQL query on crdb_internal.jobs with optional filters for job_type, status, and limit. Processes results into formatted job objects and returns them or an error.
    async def show_jobs(
        job_type: str | None = None,
        status: str | None = None,
        limit: int = 20,
    ) -> dict[str, Any]:
        """Show background jobs in the cluster.
    
        Args:
            job_type: Filter by job type (BACKUP, RESTORE, IMPORT, etc.).
            status: Filter by status (running, succeeded, failed, etc.).
            limit: Maximum jobs to return.
    
        Returns:
            List of jobs.
        """
        conn = await connection_manager.ensure_connected()
    
        try:
            query = """
                SELECT
                    job_id,
                    job_type,
                    status,
                    description,
                    created,
                    started,
                    finished,
                    fraction_completed,
                    error
                FROM crdb_internal.jobs
                WHERE 1=1
            """
    
            if job_type:
                query += f" AND job_type = '{job_type.upper()}'"
            if status:
                query += f" AND status = '{status.lower()}'"
    
            query += f" ORDER BY created DESC LIMIT {limit}"
    
            async with conn.cursor() as cur:
                await cur.execute(query)
                rows = await cur.fetchall()
    
            jobs = []
            for row in rows:
                jobs.append(
                    {
                        "job_id": str(row.get("job_id")),
                        "job_type": row.get("job_type"),
                        "status": row.get("status"),
                        "description": row.get("description"),
                        "created": str(row.get("created")) if row.get("created") else None,
                        "started": str(row.get("started")) if row.get("started") else None,
                        "finished": str(row.get("finished")) if row.get("finished") else None,
                        "progress": row.get("fraction_completed"),
                        "error": row.get("error"),
                    }
                )
    
            return {"jobs": jobs, "count": len(jobs)}
        except Exception as e:
            return {"status": "error", "error": str(e)}
  • MCP tool registration via @mcp.tool() decorator in the FastMCP server. This wrapper delegates execution to the cluster.show_jobs handler and adds error handling.
    @mcp.tool()
    async def show_jobs(
        job_type: str | None = None,
        status: str | None = None,
        limit: int = 20,
    ) -> dict[str, Any]:
        """Show background jobs in the cluster.
    
        Args:
            job_type: Filter by job type (BACKUP, RESTORE, IMPORT, etc.).
            status: Filter by status (running, succeeded, failed, etc.).
            limit: Maximum jobs to return.
    
        Returns:
            List of jobs.
        """
        try:
            return await cluster.show_jobs(job_type, status, limit)
        except Exception as e:
            return {"status": "error", "error": str(e)}
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. While it implies a read-only operation ('show'), it doesn't specify permissions required, rate limits, pagination behavior, or what happens if no filters are applied. For a tool with no annotation coverage, this lack of detail about behavioral traits is a notable shortfall.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded with the core purpose in the first sentence. The Args and Returns sections are structured clearly, though the bullet-point format could be more concise. There's minimal wasted text, earning a high score for efficiency.

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

Completeness3/5

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

Given the tool's moderate complexity (3 parameters, no annotations, but with an output schema), the description is somewhat complete. It covers parameters and return values, but lacks behavioral context and usage guidelines. The output schema reduces the need to explain returns, but overall completeness is adequate yet with clear gaps.

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?

Schema description coverage is 0%, so the description must compensate. It lists all three parameters (job_type, status, limit) with brief explanations, adding meaning beyond the bare schema. However, it doesn't provide examples, format details, or constraints (e.g., valid job_type values beyond 'BACKUP, RESTORE, IMPORT'), leaving some ambiguity. This partial compensation justifies a baseline score.

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 ('show') and resource ('background jobs in the cluster'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'show_sessions' or 'show_statements', which also list cluster resources, leaving room for potential confusion about when to use this specific tool versus others.

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 like 'show_sessions' or 'show_statements', nor does it mention any prerequisites or exclusions. It simply states what the tool does without contextual usage information, which is a significant gap given the presence of similar sibling tools.

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/bpamiri/cockroachdb-mcp'

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