Skip to main content
Glama

analyze_test_results

Analyze JUnit XML or CSV test results to compute deterministic health metrics: pass rates, flaky and ever-failing tests, never-run tests, slowest tests, and failure clusters.

Instructions

Deterministic test-results health metrics (flaky / ever-failing / never-run / slowest / failure clustering) from real test execution data — no LLM anywhere in this call path; write your own narrative from the returned numbers. Provide exactly one of junit_xml or csv_text. junit_xml is normally one JUnit XML report string for one run (accepts both a and a bare root); to analyze flakiness across MULTIPLE runs in one call, pass a JSON array of {"run_id": "...", "xml": "..."} objects (or simply a JSON array of XML strings, auto-named run-1, run-2, ...; repeated run_ids are kept as separate runs with a #2/#3 suffix and a warning) instead — either as a genuine JSON array/list argument, or as a string starting with "[" (some MCP clients stringify array arguments; both forms are accepted). csv_text needs a test-name column (name | test_name | test | testcase | title) and a status column (status | result | outcome); headers are matched case-insensitively. Status synonyms are accepted (pass/ok/success, fail/failure/ko, error/err, skip/ignored/pending). Optional columns: classname (or suite), run_id (or run/build; default "csv"), duration_s (or duration/time/elapsed, in seconds; a *_ms header or "350ms" values mean milliseconds), message (or error/details). Dropped rows and unrecognised columns are listed in warnings. If NO test could be parsed (wrong columns, empty or header-only CSV, HTML or non-JUnit XML, malformed XML) the call returns {"error": "no_tests_found", "message", "warnings"} instead of an empty 0% result. reference_tests, if given, is a list of test identities ("classname::name", or just "name" when there is no classname) expected to have run — any absent from the results are reported under never_run. A bare "name" also matches when exactly one executed test has that name (ambiguous bare names are not guessed; a warning explains). Skipped tests are NOT failures: they are excluded from pass rates and from the flaky/ever-failing verdicts and are reported separately (skipped, skipped_executions). Flaky = pass_rate (over non-skipped executions) strictly between flaky_min and flaky_max with at least 3 such executions; ever-failing = zero passes across at least 3 non-skipped executions. flaky_min/flaky_max must satisfy 0 <= flaky_min < flaky_max <= 1. Tests with fewer executions are left out of both lists; with fewer than 3 runs a warning says so, and tests that both passed and failed are listed under mixed_outcome (needs more runs). An empty flaky list on 1-2 runs means not enough data, not a stable suite. Malformed/oversized input never raises — it returns a structured {"error": "invalid_argument" | "no_tests_found", ...}. Returns the full ResultsAnalysis as JSON (runs, total_tests, executions, overall_pass_rate, flaky, ever_failing, never_run, slowest, failure_clusters, per_run, warnings, skipped_executions, skipped, mixed_outcome).

Input Schema

NameRequiredDescriptionDefault
csv_textNo
flaky_maxNo
flaky_minNo
junit_xmlNo
reference_testsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv3.1.4

TDQS

A4.7/5.0
Behavior5/5

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

With zero annotations the description carries the full burden, and it discharges it: it declares determinism, error contracts ("no_tests_found" with message+warnings; "invalid_argument"; "Malformed/oversized input never raises"), warning surfacing for dropped rows/unrecognised columns/duplicate run_ids, and the exact decision rules for flaky (pass_rate strictly between flaky_min and flaky_max with >=3 non-skipped executions) and ever-failing (zero passes over >=3 executions). The skipped-tests rule ('NOT failures') and the 1-2 run caveat prevent two classic misreadings of the output.

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

Conciseness3/5

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

Front-loaded with the highest-value facts (deterministic, exactly-one-of, array form for multi-run), but the body is a single ~350-word block with no paragraphing or bullets, and error behavior is restated twice (the no_tests_found paragraph and the closer about 'invalid_argument' | 'no_tests_found'). The length is defensible for a 5-param, 0%-coverage, no-output-schema tool, but the formatting makes scanning harder than it needs to be.

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?

No output schema exists, so the description enumerates the returned fields itself (runs, total_tests, executions, overall_pass_rate, flaky, ever_failing, never_run, slowest, failure_clusters, per_run, warnings, skipped_executions, skipped, mixed_outcome). Combined with the documented error shapes and threshold semantics, an agent has everything needed to call it and interpret the result on the first try.

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?

This is the strong point given 0% schema coverage: every one of the five parameters is explained — junit_xml's three accepted shapes including the stringified-'[' client quirk, csv_text's required/accepted column names and status synonyms plus duration unit heuristics, reference_tests' "classname::name" identity format and ambiguous-bare-name handling, and the 0 <= flaky_min < flaky_max <= 1 constraint. It falls short of a 5 only because defaults (0.2/0.8) are left to the schema and column-name semantics are dense enough to require careful reading.

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 and resource — deterministic health metrics (flaky / ever-failing / never-run / slowest / failure clustering) computed from real test execution data — and explicitly distinguishes itself from LLM-based paths ("no LLM anywhere in this call path; write your own narrative"). No sibling tool (list_kb_sources, estimate_qa_effort, etc.) overlaps with this, so an agent can route on the first clause alone.

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

Usage Guidelines5/5

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

Gives an explicit mutual-exclusion rule ("Provide exactly one of junit_xml or csv_text") and then names the alternative mode for the other use case: single run as a plain XML string vs. multiple runs as a JSON array of {run_id, xml} objects or bare XML strings. It also states the fallback behavior when neither form parses, and tells the agent to author its own narrative rather than expecting prose back.

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