MCP Tools
CodeRecon exposes 15 MCP tools across 5 groups (plus 1 dev-mode tool). Call describe(action="tool", name="<tool>") at any time to get full parameter documentation inline.
Orientation¶
| Tool | Group | Read-only? |
|---|---|---|
describe | Introspection | yes |
recon_scout | Discovery | yes |
recon | Discovery | yes |
recon_impact | Discovery | yes |
semantic_diff | Analysis | yes |
graph_cycles | Analysis | yes |
graph_communities | Analysis | yes |
blast_radius | Test Impact | yes |
covering_tests | Test Impact | yes |
recon_line_coverage | Test Impact | yes |
refactor_rename | Refactor | no |
refactor_move | Refactor | no |
refactor_commit | Refactor | no |
refactor_cancel | Refactor | no |
checkpoint | Commit | no |
Dev-mode only (enabled with recon up --dev-mode):
| Tool | Group | Read-only? |
|---|---|---|
recon_raw_signals | Discovery | yes |
Introspection¶
describe¶
Get parameter documentation for any tool, or decode an error code.
| Parameter | Type | Default | Description |
|---|---|---|---|
action | "tool" \| "error" | required | Introspection mode |
name | string? | — | Tool name (required for action="tool") |
code | string? | — | Error code (required for action="error") |
Discovery¶
recon_scout¶
Codebase orientation — structure, graph analysis, health signals. Call this first on an unfamiliar repo to understand what you're working with.
| Parameter | Type | Default | Description |
|---|---|---|---|
scope | string? | null | Path prefix to zoom into a subtree. Omit for repo-wide briefing. |
truncate | bool | true | Apply default limits to communities/cycles. Set false for full untruncated data. |
max_cycles | int? | — | Max cycles to return. Overrides default when set. |
max_communities | int? | — | Max communities to return. Default 10 when truncate=true. |
max_members_per_community | int? | — | Max members per community. Default 20 when truncate=true. |
Returns:
tree— progressively compressed directory treelanguages— language distributionentry_points— detected entry pointstop_files— PageRank-ranked most-imported filestop_symbols— PageRank-ranked most-referenced symbolscommunities— Louvain module clusterscycles— circular dependency chains (Tarjan)coverage— test coverage ratelint— lint health summarycontext— one-sentence terrain summarywarning— structural trap alert (only when a real hazard exists)zoom_targets— dirs collapsed during compression (use asscopefor follow-up)
recon¶
Task-aware context retrieval. Given a natural language task description, returns ranked semantic spans with code snippets from the most relevant definitions.
Pipeline: retrieve → gate → rank → cutoff → snippet extraction. Top half of results include full code snippets. Bottom half include signature + docstring only.
{
"task": "Add retry logic to the HTTP client when rate-limited",
"seeds": ["HttpClient", "send_request"],
"pins": ["src/http/client.py"],
"read_only": true
}
| Parameter | Type | Default | Description |
|---|---|---|---|
task | string | required | Natural language task description — be specific, include symbol names |
seeds | string[] \| string | [] | Symbol names to prioritize in retrieval |
pins | string[] \| string | [] | File paths to always include |
read_only | bool? | null | Session intent: true = research-only (mutations blocked), false = read-write. Omit to keep current session state. |
Response fields:
| Field | Description |
|---|---|
gate | Quality gate: OK / UNSAT / BROAD / AMBIG |
results | Ranked list of spans — top half include full snippet, bottom half sig only |
metrics | Retrieval diagnostics |
hint | Actionable follow-up guidance |
Gate meanings
OK— good context found, proceedUNSAT— task assumptions don't match the codebaseBROAD— task is too vague, decompose itAMBIG— term is ambiguous, specify which subsystem
Required before structural refactors
refactor_rename and refactor_move require a prior recon call in the same session.
recon_impact¶
Read-only reference analysis — find every place a symbol or file is referenced. Use this before deciding whether a rename/move is worth doing.
| Parameter | Type | Default | Description |
|---|---|---|---|
target | string | required | Symbol name or file path |
justification | string | required | Why you're running this analysis |
include_comments | bool | true | Include comment references |
Returns references list with path, line, match_text, and certainty. No refactor ID is created — this is always read-only.
Analysis¶
semantic_diff¶
Structural change summary from index facts. Diff the index between two Git refs, showing which definitions changed.
| Parameter | Type | Default | Description |
|---|---|---|---|
base | string | "HEAD" | Base ref (commit SHA, branch, tag, or epoch:N) |
target | string? | working tree | Target ref |
paths | string[]? | all | Limit to specific paths |
scope_id | string? | — | Scope ID for budget tracking |
graph_cycles¶
Detect dependency cycles in the codebase. Returns all strongly connected components (size > 1) with graph metadata. Unlike recon_scout, returns complete untruncated cycle data.
| Parameter | Type | Default | Description |
|---|---|---|---|
level | string | "file" | Analysis level: "file" (import graph) or "def" (reference graph) |
graph_communities¶
Detect module communities via Louvain community detection. Returns all communities with full member lists and graph metadata. Unlike recon_scout, returns complete untruncated community data.
| Parameter | Type | Default | Description |
|---|---|---|---|
level | string | "file" | Analysis level: "file" or "def" |
resolution | float | 1.0 | Louvain resolution parameter. Higher = more communities. |
Test Impact¶
blast_radius¶
Compute blast radius for changed files. Resolves changed files to their definitions, then uses coverage data and call-graph reachability to identify affected tests with confidence scores.
| Parameter | Type | Default | Description |
|---|---|---|---|
changed_files | string[] | required | Repo-relative paths of changed files to analyze |
max_hops | int | 2 | Maximum call-graph hops for test discovery |
Returns ranked test candidates with distance and confidence scores.
covering_tests¶
Get covering tests for each definition in a file. Returns a mapping from def_uid to the test candidates that cover it. Useful for per-function test annotation in diff viewers.
| Parameter | Type | Default | Description |
|---|---|---|---|
file_path | string | required | Repo-relative file path to find covering tests for |
recon_line_coverage¶
Get per-line coverage for a file. Returns covered/uncovered line numbers and optionally which tests hit each line in the specified range.
| Parameter | Type | Default | Description |
|---|---|---|---|
file_path | string | required | Repo-relative file path to query coverage for |
line_start | int? | whole file | Start of line range (1-based, inclusive) |
line_end | int? | whole file | End of line range (1-based, inclusive) |
include_tests | bool | false | Include per-line test attribution (which tests hit each line) |
Refactor¶
Structural refactors follow a preview → commit/cancel flow. No changes are written until you call refactor_commit.

refactor_rename ──→ refactor_commit (applies changes)
refactor_move ──→ refactor_cancel (discards preview)
Recon required
All refactor tools require a prior recon call in the current session.
refactor_rename¶
Rename a symbol across the entire codebase. Produces a preview with per-hunk certainty ratings.
{
"symbol": "HttpClient",
"new_name": "RestClient",
"justification": "Aligning with REST naming conventions",
"include_comments": true
}
| Parameter | Type | Default | Description |
|---|---|---|---|
symbol | string | required | Symbol name to rename (not path:line:col) |
new_name | string | required | New name |
justification | string | required | Why you're renaming |
include_comments | bool | true | Include comment/string references |
contexts | string[]? | all | Limit to specific file paths |
Preview response includes:
refactor_id— pass torefactor_commitorrefactor_cancelpreview.edits— per-file hunks withold,new,line,certaintypreview.verification_required— true if any low-certainty matches need reviewdisplay_to_user— human-readable summary to show the user
refactor_move¶
Move a file/module and automatically update all imports that reference it.
{
"from_path": "src/http/client.py",
"to_path": "src/rest/client.py",
"justification": "Relocating to new module structure"
}
| Parameter | Type | Default | Description |
|---|---|---|---|
from_path | string | required | Source file path |
to_path | string | required | Destination file path |
justification | string | required | Why you're moving |
include_comments | bool | true | Include comment references |
refactor_commit¶
Apply a previewed refactoring, or inspect low-certainty matches before committing.
Apply mode (no inspect_path):
Inspect mode (review low-certainty matches in a file before committing):
| Parameter | Type | Default | Description |
|---|---|---|---|
refactor_id | string | required | ID from the rename/move preview |
inspect_path | string? | — | File to inspect instead of applying |
context_lines | int | 2 | Context lines shown in inspect mode |
refactor_cancel¶
Discard a pending refactoring preview without making any changes.
Commit¶
checkpoint¶
All-in-one lint → test → commit → (optional push) workflow. Designed to be the last step in a coding task.
{
"changed_files": ["src/http/client.py", "tests/test_client.py"],
"commit_message": "refactor: rename HttpClient to RestClient",
"push": false
}
| Parameter | Type | Default | Description |
|---|---|---|---|
changed_files | string[] | required | Files modified in this task |
lint | bool | true | Run lint before tests |
autofix | bool | true | Apply lint auto-fixes |
tests | bool | true | Run affected tests |
test_filter | string? | — | Filter test names (passed to pytest -k, jest --testNamePattern) |
max_test_hops | int? | auto | Max import-graph hop depth for test selection. 0 = direct tests only, 1 = direct + 1 transitive. Default: 0 for fast iteration; auto-escalates to 2 hops when commit_message is set. |
commit_message | string? | — | If set and checks pass, auto-commit with this message |
push | bool | false | Push to origin after auto-commit (only used with commit_message) |
include_test_impact | bool | false | Include blast-radius candidates and coverage summary in output |
What checkpoint does:
- Runs lint on the full repo (with auto-fix by default)
- Checks for cached background test results from the daemon's test scheduler
- If no cached results, falls back to live test discovery via import graph from
changed_files - If
commit_messageis set and all checks pass: stage → pre-commit hooks → commit - If
pushis set: push to origin
Import-graph tiered testing
Tests are run in hop order: files that directly import changed files run first. If those pass, transitive tests run. This makes checkpoint fast for small changes and thorough for large ones.
Dev-Mode Tools¶
recon_raw_signals¶
Raw retrieval signals for ranking model training. Runs all retrievers (lexical, term match, graph, symbol) against the current index and returns the unfiltered candidate pool with per-retriever scores and ranks per DefFact. Does not run any model (ranker, cutoff, gate). Does not filter, sort, or truncate. Only available when the daemon is started with --dev-mode.
| Parameter | Type | Default | Description |
|---|---|---|---|
query | string | required | Query string to evaluate against the index |
seeds | string[] \| string | [] | Symbol names to inject as explicit seed candidates |
pins | string[] \| string | [] | File paths to inject as pinned candidates (all defs in each file) |
Typical Agent Workflow¶

1. recon_scout → understand repo structure
2. recon(task=...) → find relevant code
3. [read files, make edits]
4. recon_impact(...) → verify nothing unexpected breaks
5. checkpoint(...) → lint, test, commit
For structural renames / moves: