Skip to main content
Glama

Vitest MCP Server

analyze_coverage

Identify untested code, analyze test coverage, and generate actionable insights for lines, functions, branches, and statements. Excludes non-production files automatically and provides recommendations to improve coverage. Requires project root setup and supports summary or detailed output formats.

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

NameRequiredDescriptionDefault
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.
formatNoOutput format: "summary" (basic metrics), "detailed" (comprehensive analysis with file details)summary
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.

Input Schema (JSON Schema)

{ "properties": { "exclude": { "default": [], "description": "Glob patterns to exclude from coverage analysis. Examples: [\"***.test.*\", \"**/e2emocks/**\"]. Useful for excluding test files, stories, mocks, or other non-production code from coverage calculations.", "items": { "type": "string" }, "type": "array" }, "format": { "default": "summary", "description": "Output format: \"summary\" (basic metrics), \"detailed\" (comprehensive analysis with file details)", "enum": [ "summary", "detailed" ], "type": "string" }, "target": { "description": "Source 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.", "type": "string" } }, "required": [ "target" ], "type": "object" }

Other Tools from Vitest MCP Server

Related Tools

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