You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(mcp): make get_conformance and generate_refactoring_code opt-in
Both tools were advertised on the default surface, but neither is a good
default. generate_refactoring_code returns an error until the repo sets
refactoring.llm.enabled, so it added schema weight for a tool most repos
can't call. get_conformance needs the workspace graph and is niche enough
that it shouldn't take a default slot; its findings still surface in the
get_risk PR-mode directive without opting the tool in.
Flip both to default=False. get_conformance keeps requires_workspace=True,
so it can only be opted in inside a workspace. Default single-repo drops
from 11 to 10 tools, workspace default from 14 to 12, opt-in grows to 4.
Updates the surface docs (MCP_TOOLS.md, CONFIG.md), the module docstring,
and adds a selection regression test.
Copy file name to clipboardExpand all lines: docs/MCP_TOOLS.md
+27-25Lines changed: 27 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
repowise exposes a curated set of tools via the [Model Context Protocol](https://modelcontextprotocol.io) (MCP). These tools give AI coding assistants (Claude Code, Codex, Cursor, Cline, Windsurf) structured access to your codebase intelligence: dependency graph, git history, documentation, and architectural decisions.
4
4
5
-
16 tools are registered in total. A single-repo server advertises 11 by default: the nine flagship tools below plus `list_repos` and `generate_refactoring_code`. Workspace mode adds 3 more automatically, for 14. Two further tools are off by default everywhere and must be opted in. The surface is configurable; see [Configuring the tool surface](#configuring-the-tool-surface).
5
+
16 tools are registered in total. A single-repo server advertises 10 by default: the nine flagship tools below plus `list_repos`. Workspace mode adds 2 more automatically (`get_architecture`, `get_blast_radius`), for 12. Four further tools are off by default everywhere and must be opted in. The surface is configurable; see [Configuring the tool surface](#configuring-the-tool-surface).
|`get_health`| Code-health marker scores | Before refactoring, find the worst files |
32
32
33
-
Also always on by default: `list_repos` (repo aliases) and `generate_refactoring_code` (opt-in code generation from a health plan). See [Supplementary tools](#supplementary-tools).
33
+
Also always on by default: `list_repos` (repo aliases). See [Supplementary tools](#supplementary-tools).
34
34
35
35
---
36
36
37
37
## Configuring the tool surface
38
38
39
39
The default surface is deliberately small: fewer, richer tools mean fewer round-trips and less schema overhead per task. What a server advertises is resolved from three things: each tool's `default`/`requires_workspace` metadata, whether the server is in workspace mode, and an optional override.
40
40
41
-
-**Default (single-repo):**11 tools, the nine flagship tools plus `list_repos` and `generate_refactoring_code` (though `generate_refactoring_code` returns an error until its config flag is set; see below).
42
-
-**Default (workspace):** those 11 plus `get_architecture`, `get_blast_radius`, and `get_conformance`, added automatically when the server starts inside a workspace. They are never advertised outside one.
43
-
-**Opt-in tools:**`get_dependency_path`and `get_execution_flows` are registered but off by default everywhere. Turn them on per repo.
41
+
-**Default (single-repo):**10 tools, the nine flagship tools plus `list_repos`.
42
+
-**Default (workspace):** those 10 plus `get_architecture`and `get_blast_radius`, added automatically when the server starts inside a workspace. They are never advertised outside one.
43
+
-**Opt-in tools:**`get_dependency_path`, `get_execution_flows`, `generate_refactoring_code`, and `get_conformance` are registered but off by default. Turn them on per repo; `get_conformance` only does useful work in workspace mode (name it there).
44
44
45
45
**Configure it in `.repowise/config.yaml`** under an `mcp.tools` key. Four shapes are supported:
46
46
@@ -504,25 +504,6 @@ Lists the repos this server is serving. No parameters.
504
504
list_repos()
505
505
```
506
506
507
-
### `generate_refactoring_code`
508
-
509
-
Turns one structured refactoring plan from `get_health(include=["refactoring"])` into actual generated code and a unified diff, grounded on the plan plus the real source spans it references. For Extract Class, the result includes an LCOM4 before/after self-check.
510
-
511
-
**Disabled by default.** Returns `{"error": "disabled", ...}` unless `refactoring.llm.enabled: true` is set in the repo's `.repowise/config.yaml`. When enabled, it uses the repo's configured LLM provider/model (bring your own key) and caches results by a content hash, so an unchanged plan never regenerates.
512
-
513
-
**Parameters:**
514
-
515
-
| Parameter | Type | Required | Description |
516
-
|-----------|------|----------|-------------|
517
-
|`suggestion_id`| string | Yes | The `id` of a plan returned by `get_health(include=["refactoring"])`|
518
-
|`repo`| string | No |*(workspace only)* Target repo alias |
519
-
520
-
**When to use:** After `get_health(include=["refactoring"])` surfaces a plan you want turned into an applyable diff, and your repo has opted into LLM-backed generation.
Architecture governance: does the live system graph obey the declared dependency rules, and are there circular service dependencies?
552
533
534
+
**Opt-in.** Off by default even in workspace mode; enable with `mcp.tools: ["+get_conformance"]`. Named in single-repo mode it is ignored, since it needs the workspace graph. The same findings still surface in the `get_risk` PR-mode directive (`conformance_violations` / `dependency_cycles`) without opting the tool in.
535
+
553
536
| Parameter | Type | Required | Description |
554
537
|-----------|------|----------|-------------|
555
538
|`repo`| string | No | Limit findings to those involving this repo alias |
Turns one structured refactoring plan from `get_health(include=["refactoring"])` into actual generated code and a unified diff, grounded on the plan plus the real source spans it references. For Extract Class, the result includes an LCOM4 before/after self-check.
606
+
607
+
**Off by default twice over:** it must be opted into the tool surface (`mcp.tools: ["+generate_refactoring_code"]`), and even then returns `{"error": "disabled", ...}` unless `refactoring.llm.enabled: true` is set in the repo's `.repowise/config.yaml`. When enabled, it uses the repo's configured LLM provider/model (bring your own key) and caches results by a content hash, so an unchanged plan never regenerates.
608
+
609
+
**Parameters:**
610
+
611
+
| Parameter | Type | Required | Description |
612
+
|-----------|------|----------|-------------|
613
+
|`suggestion_id`| string | Yes | The `id` of a plan returned by `get_health(include=["refactoring"])`|
614
+
|`repo`| string | No |*(workspace only)* Target repo alias |
615
+
616
+
**When to use:** After `get_health(include=["refactoring"])` surfaces a plan you want turned into an applyable diff, and your repo has opted into both the tool and LLM-backed generation.
@@ -633,7 +635,7 @@ The MCP server automatically enriches responses with cross-repo intelligence:
633
635
-**Package dependencies** between repos
634
636
-**Cross-repo blast radius** via the workspace-only `get_blast_radius` tool, and a cross-repo `directive` in `get_risk` PR-mode
635
637
-**Breaking-change guard**: incompatible provider-contract changes and the consumers they endanger, in the `get_risk` PR-mode `breaking_changes` directive
636
-
-**Architecture conformance**: declared dependency-rule violations and dependency cycles via the workspace-only `get_conformance` tool, and `conformance_violations` / `dependency_cycles` in the `get_risk` PR-mode directive
638
+
-**Architecture conformance**: declared dependency-rule violations and dependency cycles via the workspace-only, opt-in`get_conformance` tool, and `conformance_violations` / `dependency_cycles` in the `get_risk` PR-mode directive
637
639
-**Architecture metrics**: whole-system coupling (propagation cost), the cyclic core, per-service roles, and a deterministic 1-10 architecture score via the workspace-only `get_architecture` tool
0 commit comments