refactor
Apply automated code changes to Java projects to fix build issues and add missing dependencies via Diffblue Cover, with optional dry-run preflight.
Instructions
Invoke Diffblue Cover to refactor the project (aliased as 'fix-build').
This tool executes the dcover refactor command to apply automated
refactorings, such as fixing build issues or adding missing dependencies.
Args: path: Path to the dcover executable. If not provided, searches system PATH and the DIFFBLUE_COVER_CLI environment variable. working_directory: Root directory of the Java project to test. Defaults to the current working directory. dcover_timeout: Maximum execution time in seconds. Defaults to 600. Set to None for no timeout (not recommended). dry_run: If True, passes the '--dry-run' flag to check for readiness without applying changes. args: Additional arguments to pass to dcover. Defaults to None. ctx: MCP server context for logging and progress reporting (auto-injected by FastMCP).
Returns: dict: Execution result containing: - return_code (int): Exit code (0 for success) - status (str): "success" if completed without errors - output (str): Complete stdout/stderr from dcover - command (list[str]): The exact command that was executed - working_directory (Path): Directory where command was run
Raises: ToolError: If dcover executable not found, command fails, or timeout exceeded. The error includes the partial output collected before failure.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | No | The additional options to pass to dcover refactor | |
| path | No | The path to the dcover executable | |
| dry_run | No | Run preflight checks only (aliased as --preflight) | |
| dcover_timeout | No | The maximum time in seconds to wait for dcover to create tests. | |
| working_directory | No | The directory containing the project | /app |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |