Skip to main content
Glama

Get file coverage

get_file_coverage
Destructive

Reports JaCoCo coverage for a single source file, listing missed and partially covered lines with per-method detail so you can pinpoint untested code after identifying a weak package.

Instructions

Same JaCoCo run and task fallback as get_coverage_report, scoped to one source file: the missed and partially-covered line numbers plus per-method detail. Use it after get_coverage_report names the weakest package. file matches by suffix across every module (an ambiguous name returns every match; a miss lists the files that have data). JVM unit tests only. Pass json=true for structured JSON.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "file": "<file>"
    },
    "name": "get_file_coverage"
  }
}

Input Schema

NameRequiredDescriptionDefault
argsNoExtra arguments passed to Gradle (e.g. --stacktrace).
fileYesSource file to report coverage for — a filename (e.g. Foo.kt) or package-qualified path (e.g. com/example/Foo.kt). Matched by suffix; an ambiguous bare filename returns every match.
jsonNoReturn structured JSON instead of the human-readable text summary.
taskNoGradle 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_dirNoPath to the Android project root containing the Gradle wrapper (gradlew). Optional if session_set_defaults has pinned a project_dir for this session.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.2/5.0
Behavior4/5

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

Annotations only flag openWorldHint and destructiveHint; the description adds real context beyond that: it shares a Gradle JaCoCo run with get_coverage_report, inherits a task fallback path, warns that an ambiguous filename returns every match, and that a miss lists files that do have data. The JVM-unit-test-only restriction is a meaningful behavioral constraint an agent would not otherwise know.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Four dense sentences, front-loaded with the shared-run/scoping context before the usage hint and matching caveats. Minor redundancy: 'Pass json=true for structured JSON' duplicates the schema's json parameter description, so not every sentence earns full value.

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?

For a five-parameter tool with no output schema, the description states what comes back (missed and partial line numbers plus per-method detail) and how failures present (ambiguous match returns all matches; a miss lists files with data). Combined with the JVM-scope limit and task fallback note, an agent has everything needed to call it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so all five parameters are already documented in detail. The description's notes on suffix matching, ambiguous names, and json=true essentially restate what the schema says rather than adding new semantics. Baseline 3 applies when the schema is doing the heavy lifting.

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?

Names a specific verb+resource and pins its scope precisely: 'scoped to one source file: the missed and partially-covered line numbers plus per-method detail.' It also anchors itself against the sibling get_coverage_report by sharing 'the same JaCoCo run and task fallback,' so an agent can tell the two apart immediately.

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?

Gives an explicit sequencing rule — 'Use it after get_coverage_report names the weakest package' — which is the primary decision point between the two tools. It also states a hard applicability limit ('JVM unit tests only'). It stops short of naming when not to use it (e.g., KMP or instrumented coverage cases).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.