Skip to content

Commit 115930b

Browse files
committed
feat(mcp): add help tool for cheaper, more guided agent workflows
1 parent e30100e commit 115930b

16 files changed

+513
-27
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## [2.0.0b4]
4+
5+
In development.
6+
7+
### MCP server
8+
9+
- Add bounded MCP `help(topic=...)` as an uncertainty-recovery tool for workflow, baseline, suppressions, latest-run semantics, review state, and changed-scope routing.
10+
311
## [2.0.0b3]
412

513
2.0.0b3 is the release where CodeClone stops looking like "a strong analyzer with extras" and starts looking like a

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ codeclone-mcp --transport stdio
167167
codeclone-mcp --transport streamable-http --port 8000
168168
```
169169

170-
20 tools + 10 resources — deterministic, baseline-aware, and read-only.
170+
21 tools + 10 resources — deterministic, baseline-aware, and read-only.
171171
Never mutates source files, baselines, or repo state.
172172

173173
Payloads are optimized for LLM context: compact summaries by default, full detail on demand.
@@ -177,6 +177,9 @@ Recommended agent flow:
177177
`analyze_repository` or `analyze_changed_paths``get_run_summary` or `get_production_triage`
178178
`list_hotspots` or `check_*``get_finding``get_remediation`
179179

180+
If workflow or contract meaning is unclear, `help(topic=...)` returns a compact
181+
semantic guide with the safest next step and canonical doc links.
182+
180183
Docs:
181184
[MCP usage guide](https://orenlab.github.io/codeclone/mcp/)
182185
·
@@ -277,7 +280,7 @@ Dynamic/runtime false positives are resolved via explicit inline suppressions, n
277280
{
278281
"report_schema_version": "2.2",
279282
"meta": {
280-
"codeclone_version": "2.0.0b3",
283+
"codeclone_version": "2.0.0b4",
281284
"project_name": "...",
282285
"scan_root": ".",
283286
"report_mode": "full",

benchmarks/run_docker_benchmark.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -euo pipefail
33

44
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5-
IMAGE_TAG="${IMAGE_TAG:-codeclone-benchmark:2.0.0b2}"
5+
IMAGE_TAG="${IMAGE_TAG:-codeclone-benchmark:2.0.0b4}"
66
OUT_DIR="${OUT_DIR:-$ROOT_DIR/.cache/benchmarks}"
77
OUTPUT_BASENAME="${OUTPUT_BASENAME:-codeclone-benchmark.json}"
88
CPUSET="${CPUSET:-0}"

codeclone/mcp_server.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"get_production_triage for the first pass. Use list_hotspots or focused "
3535
"check_* tools before broader list_findings calls, then drill into one "
3636
"finding with get_finding or get_remediation. Use "
37+
"help(topic=...) when workflow or contract semantics are unclear. Use "
3738
"get_report_section(section='metrics_detail', family=..., limit=...) for "
3839
"bounded metrics drill-down, and prefer generate_pr_summary(format='markdown') "
3940
"unless machine JSON is required. Pass an absolute repository root to "
@@ -273,6 +274,27 @@ def get_production_triage(
273274
max_suggestions=max_suggestions,
274275
)
275276

277+
@tool(
278+
title="Help",
279+
description=(
280+
"Return a compact semantic guide for a supported CodeClone topic, "
281+
"with next-step routing and canonical doc links. Use this when "
282+
"workflow or contract meaning is unclear. This is bounded guidance, "
283+
"not a full manual. Supported topics: workflow, suppressions, "
284+
"baseline, latest_runs, review_state, changed_scope."
285+
),
286+
annotations=read_only_tool,
287+
structured_output=True,
288+
)
289+
def help(
290+
topic: str,
291+
detail: str = "compact",
292+
) -> dict[str, object]:
293+
return service.get_help(
294+
topic=topic, # type: ignore[arg-type]
295+
detail=detail, # type: ignore[arg-type]
296+
)
297+
276298
@tool(
277299
title="Evaluate Gates",
278300
description=(

0 commit comments

Comments
 (0)