get_coverage_report
Run a JaCoCo Gradle coverage task and summarize line, branch, method, and class percentages with a per-package breakdown, worst-covered first; multi-module reports are merged.
Instructions
Run a JaCoCo coverage-report Gradle task in project_dir (default 'jacocoTestReport') and summarize coverage: overall line/branch/method/class percentages plus a per-package breakdown, worst-covered first; multi-module reports are merged. 'jacocoTestReport' is NOT an Android Gradle plugin task: if it is missing, pass AGP's 'createDebugUnitTestCoverageReport' as task= (find it with list_gradle_tasks; see android://guide/build-and-test). JVM unit tests only. Pass json=true for structured JSON.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | No | Extra arguments passed to Gradle (e.g. --stacktrace). | |
| json | No | Return structured JSON instead of the human-readable text summary. | |
| task | No | Gradle task that generates the JaCoCo XML report. Defaults to jacocoTestReport, which is NOT a task the Android Gradle plugin defines — it exists only if the project declares it. If it is missing, check list_gradle_tasks for AGP's built-in "createDebugUnitTestCoverageReport" (present when a build type sets enableUnitTestCoverage = true). Module-qualified names work: ":app:jacocoTestReport". | |
| project_dir | No | Path to the Android project root containing the Gradle wrapper (gradlew). Optional if session_set_defaults has pinned a project_dir for this session. |