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

Tool Definition Quality

Score is being calculated. Check back soon.

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