cluster_failures
Group test failures by similar error signatures using test name and stack trace to identify root causes and prioritize fixes.
Instructions
Group failures by similar error signature.
Each failure should contain test_name and stack_trace.Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| failures | Yes |
Implementation Reference
- testFailureAnalysis.py:48-67 (handler)This is the handler function for the 'cluster_failures' tool. It groups test failures by their first stack trace line (with numbers normalized to <num>) and returns cluster count and grouped test names.
@mcp.tool() def cluster_failures(failures: list[dict]) -> dict: """ Group failures by similar error signature. Each failure should contain test_name and stack_trace. """ clusters = defaultdict(list) for failure in failures: stack = failure.get("stack_trace", "") first_error_line = stack.splitlines()[0] if stack else "unknown" signature = re.sub(r"\d+", "<num>", first_error_line) clusters[signature].append(failure.get("test_name", "unknown_test")) return { "cluster_count": len(clusters), "clusters": dict(clusters) } - testFailureAnalysis.py:48-49 (registration)The @mcp.tool() decorator registers 'cluster_failures' as an MCP tool on the FastMCP server instance.
@mcp.tool() def cluster_failures(failures: list[dict]) -> dict: