Skip to main content
Glama

TestHeal

The missing reliability layer for AI coding agents.

TestHeal is an open-source MCP server that gives Claude Code, Cursor, Gemini CLI, OpenCode, Aider, Continue, and any other agent reliable root-cause diagnosis and minimal, high-confidence fixes for failing tests.

Most coding agents treat test failures as just more text. They guess, invent new bugs, make oversized edits, or get stuck in loops. TestHeal is a specialized tool they can call to do the hard diagnostic work properly.

Responsibility notice: This tool is designed to assist agents, not replace human judgment. Every fix it proposes should still be reviewed. We take the responsibility of shipping high-quality, safe defaults extremely seriously.


Why this exists

Current coding agents are excellent at writing code but still weak at:

  • Distinguishing root cause from symptoms

  • Producing minimal patches instead of large rewrites

  • Assessing whether a proposed fix is safe

  • Avoiding regression-prone changes

  • Breaking out of infinite fix loops

TestHeal is purpose-built to solve exactly these weaknesses.


Related MCP server: MCP Workflow Engine

Features

  • Precise root-cause analysis — ranked hypotheses with confidence scores

  • Minimal patches — unified diffs that change as little as possible

  • Safety assessment — risk of regressions + which other tests may be affected

  • Agent-optimized schemas — clean JSON that LLMs parse reliably

  • LLM-friendly errors — every error message tells the agent what to do next

  • Works with any model — you bring your own LLM (OpenAI, Anthropic, local, etc.)

  • Zero arbitrary code execution by default — safe by design


Quick Start

1. Install

npm install -g @test-heal/mcp-server
# or run directly
npx -y @test-heal/mcp-server

2. Add to your agent

Claude Code / Claude Desktop

Add to your MCP config:

{
  "mcpServers": {
    "test-heal": {
      "command": "npx",
      "args": ["-y", "@test-heal/mcp-server"],
      "env": {
        "OPENAI_API_KEY": "your-key-here"   // or ANTHROPIC_API_KEY, etc.
      }
    }
  }
}

Cursor

Go to Settings → MCP and add the same configuration.

Other agents (Gemini CLI, OpenCode, etc.)

Any client that supports the Model Context Protocol can use it.


Tools Exposed

1. diagnose_test_failure

Purpose: Deep root-cause analysis of a failing test.

Input:

  • test_output (string, required) — full failure output / stack trace

  • source_files (array of {path, content}) — relevant source code

  • git_diff (string, optional) — recent changes

  • language (string, optional) — e.g. "typescript", "python"

  • framework (string, optional) — e.g. "jest", "pytest", "vitest"

Output:

{
  "root_causes": [
    {
      "rank": 1,
      "hypothesis": "...",
      "confidence": 0.87,
      "evidence": ["..."],
      "location": { "file": "...", "lines": "42-48" }
    }
  ],
  "summary": "...",
  "recommended_next_step": "call propose_minimal_fix with root_cause_id=1"
}

2. propose_minimal_fix

Purpose: Generate the smallest possible safe patch for a diagnosed root cause.

Input:

  • Everything from diagnose + root_cause_id or full diagnosis object

Output:

{
  "patch": "--- a/src/foo.ts\n+++ b/src/foo.ts\n@@ ...",
  "explanation": "...",
  "confidence": 0.91,
  "files_changed": ["src/foo.ts"],
  "risk_level": "low"
}

3. assess_fix_safety

Purpose: Evaluate whether a proposed patch is likely to introduce regressions.

Output:

{
  "risk_level": "low" | "medium" | "high",
  "potential_regressions": ["..."],
  "affected_tests": ["..."],
  "recommendation": "safe to apply" | "review carefully" | "do not apply"
}

Design Principles (we take this seriously)

  1. Minimalism first — prefer 3-line fixes over 50-line rewrites

  2. Honesty about confidence — never claim high confidence when evidence is weak

  3. Agent-first UX — every response is structured so an LLM can act on it immediately

  4. Safety by default — no shell execution, no unrestricted file writes

  5. Transparency — the reasoning is visible and inspectable

  6. Open source forever — MIT license, community-driven improvements welcome


Architecture

Agent → MCP Protocol → TestHeal Server
                           │
                           ├─ Schema validation
                           ├─ Context assembly
                           ├─ Specialized diagnosis prompts
                           ├─ Minimal-edit reasoning
                           └─ Structured JSON response

The intelligence layer currently uses high-quality prompts + your configured LLM. Future versions will add:

  • Static analysis integration (TypeScript, ESLint, mypy, etc.)

  • Historical failure pattern matching

  • Multi-agent internal debate for higher confidence


Development

git clone https://github.com/webscout9-png/test-heal.git
cd test-heal
npm install
npm run build
npm start

Contributing

We welcome contributions that improve diagnosis accuracy, add language/framework support, or strengthen safety guarantees. See CONTRIBUTING.md.

High priority areas:

  • Better static analysis integration

  • Support for more test frameworks

  • Evaluation harness with real failing tests

  • Local model support (Ollama, LM Studio, etc.)


License

MIT


Built with the belief that AI coding agents deserve better tools for the hardest part of the job: understanding why tests fail and fixing them safely.

Available Tools

3 tools
assess_fix_safetyA

Evaluate whether a proposed patch is likely to introduce regressions. Returns risk level, potential side effects, and a clear recommendation. Use before applying any non-trivial fix.

ParametersJSON Schema
NameRequiredDescriptionDefault
patchYesThe unified diff to evaluate
languageNo
diagnosisNo
test_outputNo
source_filesYes

TDQS

A3.7/5.0
Behavior3/5

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

With no annotations provided, the description must carry the behavioral transparency burden. It discloses what the tool returns and strongly implies through 'Evaluate' and 'Use before applying' that it is an analysis-only operation. However, it never explicitly states that the patch is not applied or that no code is modified, leaving a meaningful behavioral trait implicit rather than stated.

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 three short, purposeful sentences: it front-loads the core purpose, then the output, then the usage condition. Every sentence contributes new information and there is no filler.

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?

The tool is moderately complex with five parameters, nested objects, no annotations, low schema coverage, and no output schema, yet the description does not mention the required source_files parameter or when to provide optional diagnosis/test_output/language. It only vaguely characterizes the return value, leaving too much for an agent to infer.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is only 20%, so the description needs to compensate. 'Proposed patch' maps to the patch parameter, but there is no explanation of the required source_files array or the optional language, diagnosis, and test_output inputs. An agent gets little parameter-level guidance beyond the raw schema.

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?

The description opens with a specific verb ('Evaluate'), a clear resource ('proposed patch'), and the exact question it answers ('likely to introduce regressions'). The mention of risk level, side effects, and recommendation makes the tool's role unmistakable and clearly different from the sibling tools diagnose_test_failure and propose_minimal_fix, even without naming them.

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

Usage Guidelines4/5

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

'Use before applying any non-trivial fix' gives a clear temporal trigger and workflow context. It does not explicitly state when not to use it or contrast it with the sibling tools, so it is clear guidance but lacks exclusions or alternatives.

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

diagnose_test_failureA

Perform deep root-cause analysis of a failing test. Returns ranked hypotheses with confidence scores, evidence, and precise locations. Call this first when a test fails. Prefer this over guessing from the raw test output.

ParametersJSON Schema
NameRequiredDescriptionDefault
git_diffNoOptional recent git diff that may have introduced the failure
languageNoProgramming language, e.g. typescript, python, go, java
frameworkNoTest framework, e.g. jest, vitest, pytest, junit, go test
test_outputYesFull test failure output including stack traces, assertion messages, and any relevant logs
source_filesYesRelevant source files that may be involved in the failure. Prefer including the test file + the implementation under test.
additional_contextNoAny extra context the agent has about the failure

TDQS

A4/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 of behavioral disclosure. It does not explicitly state whether the tool is read-only or has side effects, though 'root-cause analysis' implies non-mutating. It also doesn't mention authentication, rate limits, or error behavior. However, the output description (ranked hypotheses) gives some transparency about what to expect.

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 three sentences with no fluff. The main purpose is front-loaded, followed by the output type and a clear usage directive. Every sentence earns its place, and it is efficiently structured.

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?

Given the complexity (6 params, 2 required) and no output schema, the description adequately covers the essential behavior and output. It explains what the tool returns (ranked hypotheses with confidence scores, evidence, locations) and when to use it. It could mention edge cases like empty results or specific input requirements, but the schema already covers input constraints. Overall, it's sufficient for an agent to call it correctly.

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%, meaning every parameter has a description in the schema itself. The tool description adds no parameter-specific details beyond that. Since the schema already documents each parameter thoroughly, the description doesn't need to repeat it. Baseline of 3 is appropriate.

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?

The description states a specific verb ('Perform deep root-cause analysis') and resource ('a failing test'), and clearly distinguishes its output (ranked hypotheses with confidence scores, evidence, locations). This differentiates it from siblings like propose_minimal_fix and assess_fix_safety, which focus on fixing and safety assessment respectively.

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

Usage Guidelines4/5

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

The description explicitly says 'Call this first when a test fails' and contrasts with 'guessing from the raw test output', giving clear when-to-use guidance. It doesn't explicitly name alternatives or when-not-to-use, but the directive 'Call this first' is strong. The sibling tool names are not mentioned, but the context implies this is the diagnostic first step.

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

propose_minimal_fixA

Generate the smallest possible high-confidence patch for a diagnosed root cause. Always prefer minimal edits. Returns a unified diff, explanation, confidence, and risk level. Call diagnose_test_failure first when possible.

ParametersJSON Schema
NameRequiredDescriptionDefault
git_diffNo
languageNo
diagnosisNoOutput from a previous diagnose_test_failure call. Strongly recommended.
frameworkNo
constraintsNoAny constraints the agent must respect (e.g. 'do not change public API', 'keep existing test structure')
test_outputYes
source_filesYes
root_cause_idNoWhich ranked root cause to fix (1-based). Defaults to 1.

TDQS

A3.9/5.0
Behavior4/5

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

With no annotations, the description carries the full behavioral burden. It discloses the algorithm's preference ('Always prefer minimal edits'), the nature of the output (unified diff, explanation, confidence, risk level), and the contextual requirement of a diagnosed root cause. It does not explicitly state that the tool only proposes a patch and does not modify files, but the name and 'returns a diff' strongly imply that.

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 three short sentences with no filler. It front-loads the core behavior, then the policy, then the return format, and finally the workflow prerequisite. Every sentence earns its place.

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?

The tool is complex: 8 parameters, nested objects, no output schema, and sparse schema descriptions. The description gives a helpful workflow hint and lists returned fields, but it does not explain how to construct the required inputs, how diagnosis and root_cause_id interact, what constraints/git_diff are for, or what the risk level output looks like. Significant gaps remain for an agent to invoke this correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is only 38%, so the description needed to compensate, but it does not explain the roles of test_output, source_files, git_diff, language, framework, constraints, or root_cause_id. The only semantic hint is that a diagnosis should precede the call, which weakly maps to the `diagnosis` parameter. This is insufficient for an 8-parameter tool with nested objects.

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?

The description opens with a specific verb and resource: 'Generate the smallest possible high-confidence patch for a diagnosed root cause.' It also states the return payload (unified diff, explanation, confidence, risk level) and the core policy ('Always prefer minimal edits'), which clearly distinguishes it from the sibling tools diagnose_test_failure and assess_fix_safety.

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

Usage Guidelines4/5

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

The description explicitly instructs 'Call diagnose_test_failure first when possible', giving a clear workflow prerequisite and indicating this tool consumes an earlier diagnosis. It does not mention assess_fix_safety or provide exclusion criteria, but the sequencing guidance is concrete and useful.

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

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 3 tool updatesv0.1.0
    • First observedassess_fix_safety
    • First observeddiagnose_test_failure
    • First observedpropose_minimal_fix

TDQS

A4/5.0

Scored across 3 tools

Disambiguation5/5

Each tool handles a distinct stage of a clear pipeline: diagnose, propose, assess. There is no overlap or ambiguity about which tool to call at each step.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern: diagnose_test_failure, propose_minimal_fix, assess_fix_safety. The verbs clearly indicate distinct actions and the nouns describe the target artifact.

Tool Count4/5

Three tools is on the smaller side, but each covers a necessary phase of the test-fix workflow. The count is reasonable for a focused MCP server, though slightly thin.

Completeness4/5

The tools cover the core diagnose-propose-assess lifecycle well. A minor gap is the lack of an explicit tool to apply or commit the fix, but that may be intentionally outside the server's scope.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers