Skip to main content
Glama
jermeyyy
by jermeyyy

daemon_status

Monitor Gradle daemon health and resource usage by checking current daemon status and information for troubleshooting and optimization.

Instructions

Get status of Gradle daemon(s).

Returns current daemon status including running daemons and their info. Useful for monitoring daemon health and resource usage.

Returns: DaemonStatusResult with running status, list of daemon info, and optional error.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
errorNo
daemonsYes
runningYes

Implementation Reference

  • The main MCP tool handler for 'daemon_status', decorated with @mcp.tool() for automatic registration. It fetches raw status from GradleWrapper, parses the output to extract daemon PIDs, statuses, and constructs the DaemonStatusResult.
    @mcp.tool()
    async def daemon_status(ctx: Context | None = None) -> DaemonStatusResult:
        """Get status of Gradle daemon(s).
    
        Returns current daemon status including running daemons and their info.
        Useful for monitoring daemon health and resource usage.
    
        Returns:
            DaemonStatusResult with running status, list of daemon info, and optional error.
        """
        try:
            if ctx:
                await ctx.info("Getting Gradle daemon status")
    
            gradle = _get_gradle_wrapper(ctx)
            result = await gradle.daemon_status()
    
            if ctx:
                if result["success"]:
                    await ctx.info("Retrieved daemon status successfully")
                else:
                    await ctx.error("Failed to get daemon status", extra={"error": result.get("error")})
    
            # Parse daemon output to extract daemon info
            daemons: list[dict] = []
            running = False
            output = result.get("output", "")
    
            if result["success"] and output:
                # Parse lines looking for daemon entries
                # Format: "   12345 IDLE     8.5"
                for line in output.split("\n"):
                    line = line.strip()
                    # Skip header and empty lines
                    if not line or line.startswith("PID") or line.startswith("-"):
                        continue
                    # Try to parse daemon status line
                    parts = line.split()
                    if len(parts) >= 2 and parts[0].isdigit():
                        daemon_info = {
                            "pid": parts[0],
                            "status": parts[1] if len(parts) > 1 else "UNKNOWN",
                        }
                        if len(parts) > 2:
                            daemon_info["info"] = " ".join(parts[2:])
                        daemons.append(daemon_info)
                        running = True
    
            return DaemonStatusResult(
                running=running,
                daemons=daemons,
                error=result.get("error"),
            )
        except Exception as e:
            return DaemonStatusResult(
                running=False,
                daemons=[],
                error=str(e),
            )
  • Pydantic BaseModel defining the return type/schema for the daemon_status tool response, including running status, list of daemon details, and optional error.
    class DaemonStatusResult(BaseModel):
        """Result of daemon status query."""
    
        running: bool
        daemons: list[dict]  # List of daemon info
        error: str | None = None
  • Low-level helper method in GradleWrapper class that executes './gradlew --status' to retrieve raw daemon status output, which is then parsed by the MCP handler.
    async def daemon_status(self) -> dict:
        """Get status of Gradle daemons.
    
        Returns:
            dict with 'success' bool, 'output' str (daemon status info), and optional 'error' str.
        """
        cmd = [str(self.wrapper_script), "--status"]
    
        logger.info(f"Executing: {' '.join(cmd)}")
    
        try:
            process = await asyncio.create_subprocess_exec(
                *cmd,
                cwd=str(self.project_root),
                stdout=asyncio.subprocess.PIPE,
                stderr=asyncio.subprocess.PIPE,
                env=self._build_execution_environment(),
            )
    
            stdout, stderr = await process.communicate()
            stdout_str = stdout.decode() if stdout else ""
            stderr_str = stderr.decode() if stderr else ""
    
            if process.returncode == 0:
                logger.info("Daemon status retrieved successfully")
                return {"success": True, "output": stdout_str, "error": None}
            else:
                error_message = stderr_str or stdout_str or "Failed to get daemon status"
                logger.error(f"Daemon status failed: {error_message}")
                return {"success": False, "output": stdout_str, "error": error_message}
        except Exception as e:
            logger.error(f"Daemon status failed with exception: {e}")
            return {"success": False, "output": "", "error": str(e)}
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 the tool returns status information (a read operation) and hints at monitoring use, but lacks details on permissions, rate limits, or error handling beyond mentioning an optional error in returns. This is adequate but has gaps for a tool with no annotation coverage.

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, followed by usage context and return details in three concise sentences. Every sentence adds value without waste, making it efficiently structured.

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) and the presence of an output schema (which covers return values), the description is mostly complete. It provides purpose, usage, and a high-level overview of returns, but could slightly enhance behavioral transparency for a tool with no annotations.

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 does not discuss parameters, earning a baseline score of 4 for not adding unnecessary information.

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 ('Get status') and resource ('Gradle daemon(s)'), and distinguishes it from siblings like 'stop_daemon' by focusing on monitoring rather than control. It explicitly mentions what the tool does without being tautological.

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 provides clear context for when to use this tool ('Useful for monitoring daemon health and resource usage'), which implicitly distinguishes it from siblings like 'run_task' or 'clean'. However, it does not explicitly state when not to use it or name alternatives, keeping it at a 4.

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/jermeyyy/gradle-mcp'

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