Skip to main content
Glama
rudrathkr

MCP Test Failure Analysis Server

by rudrathkr

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

TableJSON Schema
NameRequiredDescriptionDefault
failuresYes

Implementation Reference

  • 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)
        }
  • 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:
Behavior2/5

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

No annotations are provided, so the description must cover behavioral traits. It only states grouping by error signature but omits details about output, state modifications, error handling, or performance implications.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, highly concise, and front-loaded with the core action. Every word adds value without redundancy.

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

Completeness2/5

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

There is no output schema and no description of return values. The tool clusters failures but doesn't indicate what the output looks like (e.g., clusters with centroid signatures). This is a significant gap for a grouping tool.

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?

The single parameter 'failures' is an array of objects without schema descriptions. The description compensates by specifying that each failure should contain 'test_name' and 'stack_trace', adding meaning beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'group' and resource 'failures by similar error signature', and specifies required fields. It distinguishes from sibling tools like analyze_test_failure and detect_flaky_tests, though not explicitly.

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?

No guidance is provided on when to use this tool versus its siblings. There is no mention of scenarios where clustering is appropriate or when to use alternative tools.

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/rudrathkr/MCPServerCreationPythonSDK'

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