Skip to main content
Glama
baramubarok

playwright-generate-mcp

by baramubarok

Score test quality

score_test_quality

Analyze Playwright spec files and Page Objects via TypeScript AST to measure semantic locators vs raw CSS/XPath, assertion density, and anti-patterns. Get line-number warnings and scaffold status.

Instructions

Score a spec file and its imported Page Objects with the TypeScript AST (comments and strings are ignored): % semantic locators vs raw CSS/XPath, assertion density, anti-pattern warnings with line numbers, and scaffold skeleton status.

Input Schema

NameRequiredDescriptionDefault
specPathYesPath to the spec file or page object to score, relative to project root or absolute.
projectRootNoOptional path to the project root. If omitted, auto-detected by searching for playwright.config.*.
generateHtmlReportNoSet to true to generate the standalone visual quality report at test-results/quality-report.html.

Output Schema

NameRequiredDescriptionDefault
scaffoldYes
warningsYes
antiPatternsYes
fileBreakdownNo
locatorQualityYes
assertionDensityYes
qualityReportHtmlPathNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A3.5/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It does disclose a genuine behavioral trait — TypeScript AST parsing that ignores comments and strings, plus line-numbered warnings — which is more than a bare restatement. However it never states that the operation is read-only (it is not, when generateHtmlReport writes a file) or what prerequisites/configuration it depends on.

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?

A single compact sentence that front-loads the verb, target, and mechanism before listing the outputs. Dense but every clause earns its place; only the long colon-separated metric list makes it slightly heavy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With full schema coverage and an output schema that carries the return shape, the description only needs to justify the tool's existence and it does so clearly. The one remaining gap is the absence of a stated precondition or relationship to prerequisite/config siblings, which slightly limits an agent's routing confidence.

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 description coverage is 100%, so all three parameters (specPath, projectRoot, generateHtmlReport) are already documented in the schema, setting the baseline at 3. The description adds no syntax, format, or constraint detail beyond the schema, though its mention of 'imported Page Objects' loosely reinforces that specPath accepts a page object too.

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?

States a specific verb (score) and precise resource (a spec file plus its imported Page Objects), then enumerates the exact metrics produced: semantic-vs-raw locator ratio, assertion density, anti-pattern warnings, and scaffold status. This is unmistakably distinct from every sibling (run_playwright_test, generate_test_report, check_test_prerequisites), so no explicit sibling routing is needed.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description says what the tool computes but never states when to reach for it instead of alternatives such as run_playwright_test or generate_test_report, nor any precondition (e.g. a resolved project root, a sibling tool for prerequisites). Usage is only inferable from the purpose itself.

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