Skip to main content
Glama
jermeyyy
by jermeyyy

stop_daemon

Stop all running Gradle daemons to free up memory or resolve daemon-related issues in your Gradle projects.

Instructions

Stop all Gradle daemons.

Stops all running Gradle daemons. Useful for freeing up memory or when experiencing daemon-related issues.

Returns: TaskResult with success status and error message if failed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
errorNo
successYes

Implementation Reference

  • MCP tool handler for 'stop_daemon'. Decorated with @mcp.tool() for registration. Calls GradleWrapper.stop_daemon() and handles context logging and returns TaskResult.
    @mcp.tool()
    async def stop_daemon(ctx: Context | None = None) -> TaskResult:
        """Stop all Gradle daemons.
    
        Stops all running Gradle daemons. Useful for freeing up memory
        or when experiencing daemon-related issues.
    
        Returns:
            TaskResult with success status and error message if failed.
        """
        try:
            if ctx:
                await ctx.info("Stopping Gradle daemons")
    
            gradle = _get_gradle_wrapper(ctx)
            result = await gradle.stop_daemon()
    
            if ctx:
                if result["success"]:
                    await ctx.info("Gradle daemons stopped successfully")
                else:
                    await ctx.error("Failed to stop daemons", extra={"error": result.get("error")})
    
            return TaskResult(
                success=result["success"],
                error=result.get("error"),
            )
        except Exception as e:
            return TaskResult(
                success=False,
                error=str(e),
            )
  • Core helper method in GradleWrapper class that executes './gradlew --stop' to stop all Gradle daemons.
    async def stop_daemon(self) -> dict:
        """Stop all Gradle daemons.
    
        Returns:
            dict with 'success' bool and optional 'error' str.
        """
        cmd = [str(self.wrapper_script), "--stop"]
    
        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("Gradle daemons stopped successfully")
                return {"success": True, "error": None}
            else:
                error_message = self._extract_error_message(
                    stdout_str, stderr_str, "Failed to stop daemons"
                )
                logger.error(f"Stop daemon failed: {error_message}")
                return {"success": False, "error": error_message}
        except Exception as e:
            logger.error(f"Stop daemon failed with exception: {e}")
            return {"success": False, "error": str(e)}
  • Pydantic schema for the output of the stop_daemon tool (and other task tools). Contains success flag and optional ErrorInfo.
    class TaskResult(BaseModel):
        """Result of running a Gradle task."""
    
        success: bool
        error: ErrorInfo | None = None
  • Nested error schema used within TaskResult for detailed failure information.
    class ErrorInfo(BaseModel):
        """Structured error information."""
    
        summary: str  # e.g., "Build failed: 2 tasks failed with 12 compilation errors"
        failed_tasks: list[FailedTask]  # List of failed tasks
        compilation_errors: list[CompilationError]  # Deduplicated, first occurrence only
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It clearly states this is a destructive operation ('Stops all running Gradle daemons'), mentions the purpose (freeing memory, resolving issues), and describes the return format (TaskResult with success/error). However, it doesn't specify potential side effects like interrupting ongoing builds or permission requirements.

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 perfectly structured with zero waste: first sentence states the core action, second explains purpose and use cases, third describes return format. Every sentence earns its place, and it's appropriately sized for a simple tool with no parameters.

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

Completeness5/5

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

Given the tool's simplicity (0 parameters, no annotations, but has output schema), the description is complete enough. It explains what the tool does, when to use it, and what it returns. The output schema handles return value details, so the description doesn't need to elaborate further on response structure.

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 the baseline would be 4 even without parameter information in the description. The description appropriately doesn't discuss parameters since none exist, focusing instead on the tool's behavior and output.

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 ('Stop all Gradle daemons') and distinguishes it from siblings like 'daemon_status' (which checks status) and 'run_task' (which executes tasks). It explicitly identifies the resource being acted upon (Gradle daemons) with a precise verb (stop).

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

Usage Guidelines5/5

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

The description explicitly provides when to use this tool ('Useful for freeing up memory or when experiencing daemon-related issues') and distinguishes it from alternatives by focusing on stopping daemons rather than checking status (daemon_status) or performing other operations. It gives clear context for application.

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