get_coverage_for_file
Retrieve line, branch, and function coverage metrics for specific files or path patterns to identify untested code areas and analyze project health.
Instructions
Get coverage metrics for a specific file or files matching a path pattern.
When using a user API Key (gaf_), you must provide a projectId. Use list_projects first to find available project IDs.
Parameters:
projectId: The project to query (required)
filePath: File path to search for (exact or partial match)
Returns:
Line coverage (covered/total/percentage)
Branch coverage (covered/total/percentage)
Function coverage (covered/total/percentage)
This is the preferred tool for targeted coverage analysis. Use path prefixes to focus on specific areas of the codebase:
"server/services" - Backend service layer
"server/utils" - Backend utilities
"src/api" - API routes
"lib/core" - Core business logic
Before querying, explore the codebase to identify critical paths - entry points, heavily-imported files, and code handling auth/payments/data mutations. Prioritize: high utilization + low coverage = highest impact.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | Project ID to get coverage for. Required. Use list_projects to find project IDs. | |
| filePath | Yes | File path to get coverage for. Can be exact path or partial match. |