Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.
Python aicode-complexitycode-healthcode-intelligencecode-qualitydead-codedeveloper-toolsdocumentationgit-analyticsmcpopen-sourcepythonrefactoringstatic-analysistechnical-debt
fix(mcp): return the repo='all' error dict from get_health and the finding tools (#2728)
Raghav Chamadiya2b376c9dda54
diff --git a/packages/server/src/repowise/server/mcp_server/tool_findings.py b/packages/server/src/repowise/server/mcp_server/tool_findings.pyindex ffacdd081..a5f58b036 100644--- a/packages/server/src/repowise/server/mcp_server/tool_findings.py+++ b/packages/server/src/repowise/server/mcp_server/tool_findings.py@@ -21,7 +21,11 @@ from repowise.core.persistence.crud import ()from repowise.core.persistence.database import get_sessionfrom repowise.core.registry import mcp_tool_registry as mcp-from repowise.server.mcp_server._helpers import _get_repo, _resolve_repo_context+from repowise.server.mcp_server._helpers import (+ _get_repo,+ _resolve_repo_context,+ _unsupported_repo_all,+)from repowise.server.mcp_server._meta import build_meta as _build_meta# One triage vocabulary for every layer (shared with health findings and the@@ -70,6 +74,8 @@ async def set_finding_status(f"unknown finding status: {status!r}; expected one of {ALLOWED_STATUSES}")+ if repo == "all":+ return _unsupported_repo_all("set_finding_status")ctx = await _resolve_repo_context(repo)async with get_session(ctx.session_factory) as session:repository = await _get_repo(session)diff --git a/packages/server/src/repowise/server/mcp_server/tool_health/tool.py b/packages/server/src/repowise/server/mcp_server/tool_health/tool.pyindex 8f73e3452..8285f961f 100644--- a/packages/server/src/repowise/server/mcp_server/tool_health/tool.py+++ b/packages/server/src/repowise/server/mcp_server/tool_health/tool.py@@ -17,7 +17,11 @@ from repowise.core.persistence.database import get_sessionfrom repowise.core.registry import ToolRecipefrom repowise.core.registry import mcp_tool_registry as mcpfrom repowise.server.mcp_server._budget import OmissionCollector-from repowise.server.mcp_server._helpers import _get_repo, _resolve_repo_context+from repowise.server.mcp_server._helpers import (+ _get_repo,+ _resolve_repo_context,+ _unsupported_repo_all,+)from repowise.server.mcp_server._meta import build_meta as _build_metafrom repowise.server.mcp_server.tool_health.analysis_meta import (_attach_health_analysis_meta,@@ -189,6 +193,8 @@ async def get_health(scope=scope,counts=counts,)+ if repo == "all":+ return _unsupported_repo_all("get_health")ctx = await _resolve_repo_context(repo)omission_collector = OmissionCollector("get_health", repo_root=ctx.path)pager = Pager(req.limit, req.cursor)diff --git a/packages/server/src/repowise/server/mcp_server/tool_refactoring.py b/packages/server/src/repowise/server/mcp_server/tool_refactoring.pyindex 0cf163d4c..e4191e7c9 100644--- a/packages/server/src/repowise/server/mcp_server/tool_refactoring.py+++ b/packages/server/src/repowise/server/mcp_server/tool_refactoring.py@@ -16,7 +16,11 @@ from repowise.core.analysis.health.refactoring.recommendations import hydrate_refrom repowise.core.persistence.crud import get_refactoring_suggestionfrom repowise.core.persistence.database import get_sessionfrom repowise.core.registry import mcp_tool_registry as mcp-from repowise.server.mcp_server._helpers import _get_repo, _resolve_repo_context+from repowise.server.mcp_server._helpers import (+ _get_repo,+ _resolve_repo_context,+ _unsupported_repo_all,+)from repowise.server.mcp_server._meta import build_meta as _build_meta@@ -53,6 +57,8 @@ async def generate_refactoring_code(suggestion_id: str, repo: str | None = None))from repowise.core.repo_config import load_repo_config+ if repo == "all":+ return _unsupported_repo_all("generate_refactoring_code")ctx = await _resolve_repo_context(repo)repo_path = Path(ctx.path)diff --git a/tests/unit/server/test_mcp_workspace.py b/tests/unit/server/test_mcp_workspace.pyindex c70b826c5..b0f2b9bf9 100644--- a/tests/unit/server/test_mcp_workspace.py+++ b/tests/unit/server/test_mcp_workspace.py@@ -639,6 +639,24 @@ async def test_unsupported_repo_all_get_context(workspace_mcp):assert "not supported" in result["error"]+ ("tool_name", "kwargs"),+ [+ ("get_health", {}),+ ("generate_refactoring_code", {"suggestion_id": "any"}),+ ("set_finding_status", {"suggestion_id": "any", "status": "acknowledged"}),+ ],+)+async def test_unsupported_repo_all_returns_error_dict(workspace_mcp, tool_name, kwargs):+ import repowise.server.mcp_server as mcp_server++ tool = getattr(mcp_server, tool_name)+ result = await tool(repo="all", **kwargs)++ assert result["error"].startswith(f"repo='all' is not supported for {tool_name}.")++# ---------------------------------------------------------------------------# Invalid repo alias# ---------------------------------------------------------------------------