Skip to main content
Glama

analyze_coverage

Analyze test coverage to identify untested lines, functions, branches, and statements. Get actionable insights and recommendations for improving coverage, with automatic exclusion of non-production files.

Instructions

Perform comprehensive test coverage analysis with line-by-line gap identification, actionable insights, and detailed metrics for lines, functions, branches, and statements. Automatically excludes common non-production files (stories, mocks, e2e tests) and provides recommendations for improving coverage. Detects and prevents analysis on test files themselves. Requires set_project_root to be called first. Coverage thresholds are configured via vitest.config.ts.

USE WHEN: User wants to check test coverage, identify untested code, improve test coverage, asks "what's not tested", "coverage report", "how well tested", or mentions coverage/testing quality. Essential when "vitest-mcp:" prefix is used with coverage-related requests. Prefer this over raw vitest coverage commands for actionable insights.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetYesSource file path or directory to analyze coverage for. Should target the actual source code files, NOT test files. Can be a specific source file (e.g., "./src/utils/helper.ts") or directory (e.g., "./src/components"). Relative paths resolved from project root. Required to prevent accidental full project analysis which can be slow and resource-intensive.
formatNoOutput format: "summary" (basic metrics), "detailed" (comprehensive analysis with file details)summary
excludeNoGlob patterns to exclude from coverage analysis. Examples: ["***.test.*", "**/e2emocks/**"]. Useful for excluding test files, stories, mocks, or other non-production code from coverage calculations.
Behavior4/5

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

Discloses automatic exclusion of non-production files, prevention of analysis on test files, and configuration via vitest.config.ts. No annotations exist, so description carries full burden; it adequately informs about safety and no destructive actions.

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?

Well-structured with key information upfront and a dedicated 'USE WHEN' section. Slightly verbose but every sentence adds value; no redundancy.

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?

Given no output schema, description explains what metrics are returned (lines, functions, branches, statements) and provides example patterns for exclude parameter. Covers prerequisites, automatic behaviors, and usage triggers comprehensively.

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

Parameters4/5

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

Schema coverage is 100% with good descriptions. Description adds context beyond schema: target should be source code (not test files), relative paths from project root, and why target is required (prevents slow full analysis).

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?

Description clearly states it performs test coverage analysis with metrics for lines, functions, branches, and statements, and distinguishes from sibling tools (list_tests, run_tests, set_project_root) by focusing on coverage rather than test execution or listing.

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?

Explicitly lists when to use (coverage-related queries) and states prerequisite 'Requires set_project_root to be called first'. Also recommends preferring this over raw vitest coverage commands. Missing explicit when-not usage, but the guidance is clear.

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

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/djankies/vitest-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server