Skip to content

Add read-only health tool to MCP server - #70527

Merged
pelikhan merged 1 commit into
mainfrom
pelikhan-refactored-adventure
Oct 20, 2026
Merged

pelikhan merged 1 commit into
mainfrom
pelikhan-refactored-adventure

Conversation

@pelikhan

Copy link
Copy Markdown
Collaborator

Expose workflow health reports to MCP clients so agents can inspect success rates, execution trends, and revision-aware recovery evidence without write access.

Changes

  • Add a read-only health tool wrapping gh aw health --json, with named workflow, time-window, threshold, repository, and existing-log-cache options.
  • Register the tool in default MCP configurations and document its behavior. Failure clustering uses cached logs only; no artifacts are downloaded.
  • Return a valid JSON summary when no workflows or runs are found, and cover argument handling, error propagation, read-only annotations, registration, and configuration updates.

Validation

Targeted health and MCP regression tests, MCP tool-discovery integration, build, formatting, and incremental Go lint passed. The full make agent-report-progress gate did not pass because of a shared golangci-lint lock and pre-existing custom-linter findings in mcp_argument_validation.go. A separate incremental golangci-lint run reported no new issues, and custom lint reported no health-specific findings.

Expose workflow health JSON with named filters and read-only annotations. Include health in generated MCP configurations and return JSON for empty health summaries.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review October 20, 2026 13:44
Copilot AI max review requested due to automatic review settings October 20, 2026 13:44
@pelikhan
pelikhan merged commit 4a1d915 into main Oct 20, 2026
45 of 46 checks passed
@pelikhan
pelikhan deleted the pelikhan-refactored-adventure branch October 20, 2026 13:44
Copilot stopped reviewing on behalf of pelikhan due to an error October 20, 2026 13:44
@github-actions

Copy link
Copy Markdown
Contributor

🔬 Test Quality Sentinel is analyzing test quality on this pull request...

@github-actions

Copy link
Copy Markdown
Contributor

✂️ Ponytail Reviewer has started processing this pull request

@github-actions

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer is reviewing this pull request using Matt Pocock's engineering skills...

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Design Decision Gate 🏗️ is checking for design decision records on this pull request...

@github-actions

Copy link
Copy Markdown
Contributor

🔎 PR Code Quality Reviewer is reviewing code quality for this pull request...

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Default MCP behavior and integration-test expectations contain unresolved correctness issues.

3 open issues
What changed in this PR

Exposes existing workflow health reports through a read-only MCP tool so agents can inspect execution and recovery evidence.

Changes:

  • Adds health-tool arguments, execution, and read-only annotations.
  • Updates MCP registration, default configuration, and documentation.
  • Adds regression coverage and valid JSON for empty summaries.
File Description
pkg/​cli/​mcp_tools_health.go Implements the health tool.
pkg/​cli/​mcp_tools_health_test.go Tests arguments, errors, and schema.
pkg/​cli/​mcp_server.go Registers health.
pkg/​cli/​mcp_server_unit_test.go Updates discovery expectations.
pkg/​cli/​mcp_server_tools_test.go Updates integration discovery expectations.
pkg/​cli/​mcp_server_command.go Adds health to command help.
pkg/​cli/​mcp_config_file.go Enables health in default configuration.
pkg/​cli/​mcp_config_file_test.go Updates configuration expectations.
pkg/​cli/​mcp_argument_validation.go Registers health parameters.
pkg/​cli/​mcp_argument_validation_test.go Updates parameter-registry expectations.
pkg/​cli/​init_mcp_test.go Updates initialization expectations.
pkg/​cli/​health_command.go Emits JSON for empty summaries.
pkg/​cli/​health_command_test.go Covers empty-summary JSON.
docs/​src/​content/​docs/​reference/​gh-aw-as-mcp-server.md Documents health availability and options.

Review effort: Max


// Verify expected tools are present
expectedTools := []string{"status", "compile", "logs", "audit", "audit-diff", "checks", "mcp-inspect", "work-queue", "add", "update", "fix"}
expectedTools := []string{"status", "health", "compile", "logs", "audit", "audit-diff", "checks", "mcp-inspect", "work-queue", "add", "update", "fix"}
if args.Threshold != nil {
cmdArgs = append(cmdArgs, "--threshold="+strconv.FormatFloat(*args.Threshold, 'f', -1, 64))
}
for _, option := range []struct{ flag, value string }{
{"start-date", args.StartDate},
{"end-date", args.EndDate},
{"repo", args.Repo},
{"logs-dir", args.LogsDir},
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.93.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants