weavatrix-refactor-js
v0.1.6Transactional refactoring MCP with 11 evidence-backed tools, hash-bound previews, and rollback.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
graph_stats
Return summary statistics: node count, edge count, communities, versioned edge-provenance/legacy-confidence breakdowns, and graph build time vs repo HEAD (staleness).
| Parameter | Type | Description |
|---|---|---|
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
get_node
Get full details for a specific node by label or ID.
| Parameter | Type | Description |
|---|---|---|
label * | string | Node label or ID to look up |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
get_neighbors
Get all direct neighbors of a node with edge details (1 hop, call sites deduped). For transitive impact use get_dependents; for the impact of your current branch changes use change_impact.
| Parameter | Type | Description |
|---|---|---|
label * | string | |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
relation_filter | string | Optional: filter by relation type |
query_graph
Explore a focused production-first graph around a concept or exact symbols (BFS/DFS). Exact seed files/symbols stay pinned; relation_filter and flow_direction support bounded event/data-flow views without a separate tool. Classified paths and unreferenced constant/field leaves stay suppressed unless explicitly requested.
| Parameter | Type | Description |
|---|---|---|
augment_seeds | boolean | With exact seeds, also add fuzzy question-derived seeds; false keeps traversal strictly pinned |
context_filter | array | |
depth | integer | |
flow_direction | string | Traverse outgoing, incoming, or both directions |
include_classified | boolean | Allow traversal through tests/e2e/generated/mocks/stories/docs/benchmarks/temp and explicitly excluded paths. An explicit class term in the question enables only that class. |
include_low_signal | boolean | Include unreferenced constant/field leaf symbols that do not match a query term |
mode | string | |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
question | string | Optional natural-language question or keyword search when exact seeds are not sufficient |
relation_filter | Optional relation allow-list, e.g. calls,references,imports | |
seed_files | array | Exact repo-relative file paths. Resolved exact seeds remain pinned unless augment_seeds is true |
seed_symbols | array | Exact node IDs or unambiguous symbol labels; enables focused flows without fuzzy query seeds |
token_budget | integer | Higher budget shows more nodes/edges |
god_nodes
Rank production-code connectivity hubs by unique call/import/reference neighbors, with class/method ownership reported separately from runtime connectivity. Repeated call sites do not inflate the rank; classified tests, generated/build output and other non-product paths are excluded by default.
| Parameter | Type | Description |
|---|---|---|
include_classified | boolean | Include tests/e2e/generated/build output/mocks/stories/docs/benchmarks/temp and paths explicitly excluded by repository classification |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
top_n | integer |
shortest_path
Find the shortest path between two concepts in the knowledge graph.
| Parameter | Type | Description |
|---|---|---|
source * | string | |
target * | string | |
max_hops | integer | |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
get_dependents
Transitive blast-radius of ONE node. JavaScript/TypeScript symbols use a cached on-demand EXACT_LSP point query by default, then traverse exact direct callers through the wider graph; incomplete precision is labelled and never silently presented as exact. Set precision=graph to skip LSP or include_container_importers for a conservative module-wide radius.
| Parameter | Type | Description |
|---|---|---|
label * | string | Node label or ID |
depth | integer | Max reverse hops, default 3 |
include_container_importers | boolean | Also seed importers of the symbol containing file (broader, conservative; default false) |
max_nodes | integer | Max dependents to list, default 40 |
max_references | integer | |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
precision | string | auto uses exact JS/TS point queries when precision is enabled; graph skips LSP; lsp forces an attempt |
timeout_ms | integer |
change_impact
Verdict-first, symbol-aware blast radius. Parses a zero-context git diff and uses one bounded EXACT_LSP batch query for direct references to changed JavaScript/TypeScript symbols; transitive hops stay explicitly graph-backed. Additive exports do not inherit legacy file importers. Measured coverage is used when present; otherwise static reachability is labelled, not treated as coverage.
| Parameter | Type | Description |
|---|---|---|
base | string | Base ref, e.g. origin/main or HEAD~1 (default: first existing of origin/HEAD, origin/main, origin/master, main, master) |
depth | integer | Max reverse hops, default 2 |
diff | string | Optional unified diff (prefer --unified=0) for a PR/change that is not checked out; enables symbol-level classification |
files | array | Optional repo-relative changed-file hints. Without diff evidence these are classified conservatively rather than guessed additive |
max_nodes | integer | Max impacted nodes to list, default 40 |
max_references | integer | |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
precision | string | |
timeout_ms | integer |
git_history
Behavioral architecture evidence from bounded local git history: churn × connectivity hotspots, hidden co-change coupling, and expected test/source coupling. Reads numstat only — never commit messages, authors, or source bodies.
| Parameter | Type | Description |
|---|---|---|
max_commits | integer | |
max_pairs | integer | |
min_pair_count | integer | |
months | integer | |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
top_n | integer |
verified_change
Pre-commit, proof-carrying change safeguard. Given a natural-language task and current diff/files, returns compact edit contexts, bounded call-argument data-flow, blast radius, graph/architecture/duplicate/API ratchets, affected tests, and one PASS/BLOCKED/UNKNOWN verdict. Use this high-level workflow before manually composing lower-level checks. Package tests run only when explicitly requested and WEAVATRIX_ALLOW_TEST_RUNS=1.
| Parameter | Type | Description |
|---|---|---|
task * | string | |
api_contract | object | |
base_ref | string | |
data_flow_depth | integer | |
diff | string | |
duplicate_ratchet | boolean | |
files | array | |
impact_depth | integer | |
max_data_flow_edges | integer | |
max_impact_nodes | integer | |
max_symbols | integer | |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
phase | string | |
precision | string | |
run_tests | boolean | |
test_timeout_ms | integer | |
tests | array |
trace_api_contract
Cross-repository HTTP, GraphQL, gRPC and event/topic contract, handler-liveness and blast-radius evidence. Joins static models with optional revision-bound runtime/OTLP evidence; unobserved dynamic URLs/topics/reflection remain explicit UNKNOWN. Medium/high-confidence external matches mark a handler/contract NOT_DEAD_EXTERNAL_USE. Repository paths stay local and runtime report paths are repository-contained.
| Parameter | Type | Description |
|---|---|---|
backend * | string | Backend repository UUID or exact unambiguous registry label |
clients * | array | Client repository UUIDs or exact unambiguous registry labels |
auto_discover_wrappers | boolean | Discover only simple unambiguous functions that forward a URL parameter directly to a known object-style HTTP client |
changed_files | array | Optional backend repo-relative changed files; only endpoints declared in those files are traced |
client_names | array | Extra object-style clients whose .get/.post/... methods perform HTTP requests; persistent per-repo configuration belongs in .weavatrix.json httpContracts.clientNames |
client_wrappers | array | Fixed-method wrapper calls. Use call+method for get(url), or object+member+method for transport.send(url). url_argument is zero-based. |
cursor | string | Opaque nextCursor from the previous page; bound to repository revisions and filters. |
include_tests | boolean | |
max_affected_files | integer | |
max_endpoints | integer | |
max_impact_depth | integer | |
max_matches | integer | |
method | string | |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
page_size | integer | Maximum HTTP/transport/uncertain evidence items returned on this page. |
path | string | Optional full route or segment-aligned route fragment; /query matches /edgeAnalytics/query/... and {id}, :id and concrete parameter values are normalized |
per_item_limit | integer | Compact-mode sample limit for callsites, affected files, screens and modules per item. |
response_detail | string | Compact returns bounded samples and counts. Full is explicit opt-in and still paginated. |
runtime_config | object | Optional non-secret static bindings for runtime URL prefixes, e.g. process.env.API_BASE. Values are used locally for this call and are not returned. |
runtime_evidence_files | object | Optional repository-label/UUID to repository-relative weavatrix.transport-runtime.v1 JSON path. Defaults to .weavatrix/transport-runtime.json or .weavatrix/reports/transport-runtime.json in each repos… |
runtime_evidence_max_age_hours | integer | Maximum accepted age for a revision-matched runtime evidence report |
top_n | integer | |
transport | string | Contract family to trace; all runs static and revision-bound runtime evidence for every supported transport |
get_community
Get all nodes in a community by community ID (0-indexed by size).
| Parameter | Type | Description |
|---|---|---|
community_id * | integer | Community ID (0-indexed by size) |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
search_code
Full-text or regex search across the repo source (ripgrep-backed, Node fallback). The graph only stores structure — use this to find literal text/patterns, then get_node/get_neighbors for structure.
| Parameter | Type | Description |
|---|---|---|
query * | string | text or regex to search for |
glob | string | optional path glob, e.g. "*.js" or "src/**" |
is_regex | boolean | |
max_results | integer | |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
read_source
Read the actual source of a node (by label/ID) or a repo-relative file path — the symbol's lines with context. The graph stores only locations, not source text. For a path read, pass start_line to anchor the window anywhere in the file (otherwise it shows the head).
| Parameter | Type | Description |
|---|---|---|
after | integer | |
before | integer | |
label | string | node label or ID |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
path | string | or a repo-relative file path |
start_line | integer | anchor line: window = start_line-before .. start_line+after |
inspect_symbol
Inspect one exact symbol with an on-demand TypeScript/JavaScript LSP reference query, grouped occurrence containers, graph blast radius, complexity facts and bounded local source context. Ambiguous labels fail closed; point queries never replace the broad precision overlay.
| Parameter | Type | Description |
|---|---|---|
label * | string | Exact node ID or unambiguous symbol label |
context_lines | integer | |
max_containers | integer | |
max_references | integer | |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
precision | string | |
timeout_ms | integer |
context_bundle
Return one compact, bounded source bundle for an exact symbol: definition, production-first inbound/outbound containers, exact re-export sites, on-demand TS/JS reference evidence and diverse excerpts around call sites. Use before an edit when query_graph would be too broad.
| Parameter | Type | Description |
|---|---|---|
label * | string | Exact node ID or unambiguous symbol label |
context_lines | integer | |
include_classified | boolean | Include test/e2e/generated/vendored/mock/story/docs/benchmark/temp callers after production callers |
max_reexports | integer | |
max_references | integer | |
max_related | integer | |
max_source_files | integer | |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
precision | string | |
timeout_ms | integer |
find_duplicates
Content-based clone detection over production code (MOSS winnowing over method bodies). Supports high-confidence small clones down to 12 tokens when min_tokens is lowered. Tests, classified non-product paths, all-router framework boilerplate and immutable declarative catalogs are excluded by default; opt them in explicitly.
| Parameter | Type | Description |
|---|---|---|
include_boilerplate | boolean | Include clone groups made entirely of conventional *.router.js/ts router symbols |
include_classified | boolean | Include generated/vendored/mock/story/docs/benchmark/temp and paths explicitly classified as excluded; tests still require include_tests |
include_declarative | boolean | Include repeated immutable array/object catalogs that contain no executable control flow |
include_strings | boolean | Also clone-check large multi-line string literals |
include_tests | boolean | |
min_similarity | integer | 50-100, default 80 (ignored in semantic mode) |
min_tokens | integer | min fragment size, 12-400; default 50 |
mode | string | |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
top_n | integer |
find_dead_code
Conservative review queue for statically unreferenced files, functions, methods and symbols. Returns confidence, reason, bounded evidence and explicit framework/dynamic/reflection/public-API caveats; never an auto-delete verdict. Tests, generated/vendored code, mocks, stories, docs, benchmarks and temporary roots are excluded by default.
| Parameter | Type | Description |
|---|---|---|
include_classified | boolean | Include generated/vendored/mock/story/docs/benchmark/temp and paths explicitly classified as excluded; tests still require include_tests |
include_tests | boolean | |
kinds | array | Optional candidate kinds; defaults to all |
min_confidence | string | Minimum confidence to include. low explicitly includes public/framework/dynamic review candidates |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
path | string | Optional repo-relative path prefix |
top_n | integer |
run_audit
Offline production-first repository Health review for structure, dependency declarations and lockfile integrity, bounded runtime-correctness/concurrency patterns, dead code and coverage. Vulnerability advisory matching and installed-dependency malware heuristics are separate explicit weavatrix-online tools. Unsupported Maven/Gradle import verification is NOT_SUPPORTED/PARTIAL, never a clean zero. Findings whose evidence is entirely test/e2e/generated/vendored/mock/story/docs/benchmark/temp or explicitly excluded are suppressed by default; opt them in with include_classified. category=dependenc…
| Parameter | Type | Description |
|---|---|---|
base_ref | string | Optional immutable Git baseline (for example HEAD~1 or origin/main). Enables honest new/existing/fixed debt comparison |
category | string | Only findings of this category; dependencies selects dependency manifest/import and dependency-integrity findings |
changed_files | array | Optional explicit repo-relative scope. Without base_ref this is changed-scope only; when omitted with base_ref, files are derived from the Git diff |
debt | string | Baseline comparison view. Defaults to genuinely new deterministic findings when base_ref is present |
include_classified | boolean | Include findings whose evidence is entirely tests/e2e/generated/vendored/mocks/stories/docs/benchmarks/temp or explicitly excluded |
max_findings | integer | Max findings to list, default 30 |
min_severity | string | Minimum severity to include |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
coverage_map
Map a real existing coverage report onto the graph. If no report exists, return clearly labelled static test reachability (a test imports/reaches a source file) with actualCoverage=NOT_AVAILABLE; reachability is never presented as measured coverage.
| Parameter | Type | Description |
|---|---|---|
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
path | string | Optional repo-relative path prefix filter, e.g. src/query |
top_n | integer | Max risk hotspots to list, default 15 |
hot_path_review
Rank a focused production-symbol hot-path queue from parser-derived local complexity, inside-loop allocations/copies/scans/sorts/recursion, graph fan-in/fan-out, and measured coverage or clearly labelled static test reachability. The default score gate is 85 with a narrow strong-local fallback; set min_score=0 for the full diagnostic queue. This is not profiler data or interprocedural Big-O.
| Parameter | Type | Description |
|---|---|---|
call_threshold | integer | |
cyclomatic_threshold | integer | |
include_classified | boolean | Include generated/vendored/mock/story/docs/benchmark/temp and explicitly excluded paths; tests still require include_tests |
include_tests | boolean | |
loop_depth_threshold | integer | |
min_score | integer | Focused default is 85; lower explicitly to broaden, or use 0 for every threshold-matching diagnostic candidate |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
path | string | Optional repository-relative path prefix |
time_rank_threshold | integer | |
top_n | integer |
list_communities
List graph communities named by their dominant folder (largest first) with sample files — a readable module overview; feed the list position into get_community.
| Parameter | Type | Description |
|---|---|---|
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
top_n | integer | Max communities to list, default 20 |
module_map
First orientation view for understanding an unfamiliar application with little context: a production-first folder architecture map with file/symbol counts and strongest module dependencies, separating runtime, TypeScript type-only and language compile-only coupling.
| Parameter | Type | Description |
|---|---|---|
include_non_product | boolean | Include tests, fixtures, benchmarks, generated output, docs and other classified non-product files; false by default |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
top_n | integer | Max modules to list, default 25 |
list_endpoints
Inventory of HTTP endpoints defined in the repo (Express/Fastify/Nest/Flask/FastAPI/Go mux/Rust axum and actix-web/Spring MVC and WebFlux): declared and reachable composed paths, static mount provenance, confidence, handler, file:line, and Spring conditional/default-active state.
| Parameter | Type | Description |
|---|---|---|
include_classified | boolean | Include test/e2e/generated/mock/story/docs/benchmark/temp and explicitly excluded targets |
max_results | integer | Max endpoints to list, default 100 |
method | string | |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
path | string | Optional exact composed path or segment-aligned suffix |
trace_endpoint
Resolve one exact reachable HTTP endpoint, prove its router mount chain, bind its handler symbol, and return a bounded production-only multi-hop call graph with call-site excerpts. This is a focused projection of the repository graph, not text-search inference.
| Parameter | Type | Description |
|---|---|---|
path * | string | Exact composed path; a suffix is accepted only when unambiguous |
context_lines | integer | |
handler_file | string | Repo-relative file path (or unambiguous path suffix) declaring the handler; use after an AMBIGUOUS_HANDLER result. |
include_classified | boolean | Include test/e2e/generated/mock/story/docs/benchmark/temp and explicitly excluded targets |
max_depth | integer | |
max_excerpts | integer | |
max_nodes | integer | |
method | string | |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
rebuild_graph
Rebuild the active full-repository graph and report a structural delta. Omitted mode/precision preserve the active graph; a first build uses full and the startup precision setting (lsp unless WEAVATRIX_PRECISION=off). The local TypeScript/JavaScript LSP overlay validates bounded ambiguous edges; precision:off is an explicit fallback. With scope, build an isolated diagnostic graph without replacing or diffing the full graph.
| Parameter | Type | Description |
|---|---|---|
mode | string | Build mode; omit to preserve the active mode (or use full for a first build) |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
precision | string | Semantic precision; omit to preserve the active mode (or use the startup setting for a first build) |
scope | string | Optional isolated diagnostic path prefix; never replaces the active full graph |
graph_diff
Structural graph diff: compare the current graph with an immutable Git-ref baseline (base_ref such as HEAD~1 or main), or with graph.prev.json from the last rebuild when base_ref is omitted. Reports architecture drift, cycle changes and symbols that lost their last caller.
| Parameter | Type | Description |
|---|---|---|
base_ref | string | Optional immutable Git baseline to build in isolation, e.g. HEAD~1, main or origin/main; never checks out or mutates the working tree |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
path | string | Optional node-id/path prefix to scope the diff, e.g. src/query |
get_architecture_contract
Read the owner-approved architecture target or safely bootstrap one. With action=preview, returns an adaptive candidate, observed-but-not-enforced dependency directions, verification, exact file content/hash and a short-lived confirmation token. action=approve creates the local contract only after explicit token confirmation and never overwrites an active target.
| Parameter | Type | Description |
|---|---|---|
action | string | Omit to read; preview is dry-run only; approve requires the preview token |
baseline_mode | string | Whether preview should materialize current violations as an explicit ratchet baseline |
candidate_contract | object | Optional reviewed candidate to normalize and verify during preview |
confirm_token | string | One-time token returned by preview; required for approve |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
prepare_change
Select active target-architecture rules for an intended set of changed files. Run before a non-trivial edit.
| Parameter | Type | Description |
|---|---|---|
files * | array | |
intent | string | |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
verify_architecture
Verify the fresh graph against the active target contract and ratchet; separates new, existing, fixed and excepted debt.
| Parameter | Type | Description |
|---|---|---|
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
explain_architecture_violation
Explain one active architecture violation and the governing rule.
| Parameter | Type | Description |
|---|---|---|
fingerprint * | string | |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
propose_architecture_exception
Prepare, but never apply, a bounded exception proposal for human review.
| Parameter | Type | Description |
|---|---|---|
fingerprint * | string | |
reason * | string | |
expires | string | Optional YYYY-MM-DD |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
open_repo
OFFLINE RETARGET: switch this server to another local Git repository, building its graph when missing. This explicit tool call changes the active repository boundary; pass build:false to probe without building. Omitted mode/precision preserve an existing graph; a new graph uses full and the startup precision setting (lsp unless WEAVATRIX_PRECISION=off). Omit the retarget capability at registration to pin one repository.
| Parameter | Type | Description |
|---|---|---|
path * | string | Absolute path to a Git working tree |
build | boolean | Build the graph when missing (default true) |
mode | string | Optional build mode override; omit to preserve an existing graph |
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
precision | string | Optional semantic precision override; omit to preserve an existing graph or use the startup setting for a new graph |
list_known_repos
OFFLINE RETARGET: list every registered local repository graph from the global per-user registry, regardless of parent folder.
| Parameter | Type | Description |
|---|---|---|
output_format | string | text returns only the concise TextContent summary; json also returns and mirrors the stable structuredContent envelope |
apply_edit_plan
Apply a weavatrix.edit-plan.v1 envelope (from a weavatrix-refactor-js plan producer or weavatrix-online plan_refactor) to the active repository. mode="preview" (default) verifies hashes and before-texts and issues a single-use confirm_token; mode="apply" consumes the token and writes atomically with an automatic rollback bundle. Requires WEAVATRIX_ALLOW_SOURCE_EDITS=1 to write. Only EXACT_LSP/RESOLVED/EXTRACTED/LEXICAL_EXACT edits are ever applied; uncertain references are reported, never guessed.
| Parameter | Type | Description |
|---|---|---|
plan * | object | The weavatrix.edit-plan.v1 envelope, verbatim as produced by the planning tool |
confirm_token | string | Required for mode="apply"; issued by the preview step, single-use, 5-minute TTL |
mode | string | |
output_format | string | text returns concise TextContent; json also returns the stable structuredContent envelope |
rollback_last_apply
Restore the repository files from the most recent apply_edit_plan rollback bundle. All-or-nothing: if any target file changed after the apply, nothing is restored and the drifted files are reported. Requires WEAVATRIX_ALLOW_SOURCE_EDITS=1.
| Parameter | Type | Description |
|---|---|---|
output_format | string | text returns concise TextContent; json also returns the stable structuredContent envelope |
rename_symbol
Complete cross-language rename workflow: EXACT LSP backend for JS/TS, SQL schema backend for .sql, graph+lexical backend for Rust/Python/Go/Java/C#/Solidity. Default mode="preview" proves the byte-exact edits and returns a single-use confirm_token; repeat the same call with mode="apply" and that token for an atomic write with rollback. Requires WEAVATRIX_ALLOW_SOURCE_EDITS=1 only for apply.
| Parameter | Type | Description |
|---|---|---|
new_name * | string | |
symbol * | string | Exact symbol id (file#name@line) |
confirm_token | string | Required for mode="apply"; single-use and bound to the exact generated plan and working tree |
mode | string | preview verifies the generated plan and returns a confirm_token; apply recomputes the same plan and consumes that token |
output_format | string | text returns concise TextContent; json also returns the stable structuredContent envelope |
move_file
Relocate a JS/TS file: rewrites the moved file own imports and every importer specifier, and reports the architecture dry-run (WOULD_VIOLATE/WOULD_IMPROVE). A review plan the agent applies (it renames a file), not an apply envelope.
| Parameter | Type | Description |
|---|---|---|
from * | string | |
to * | string | |
output_format | string | text returns concise TextContent; json also returns the stable structuredContent envelope |
move_symbol
Dry-run for moving a declaration to another file: predicts introduced/removed runtime cycles and architecture violations plus the blast radius. PROJECTED from graph edges — no byte-exact edits; apply the mechanical move yourself and run verified_change.
| Parameter | Type | Description |
|---|---|---|
symbol * | string | |
to_file * | string | |
output_format | string | text returns concise TextContent; json also returns the stable structuredContent envelope |
delete_readiness
Per-symbol deletion verdict {safe: true|false|UNPROVEN, knownReferences, unknownDynamicUsages, confidence, reason} plus the deletion span. Exported symbols cap at UNPROVEN; always REVIEW_REQUIRED, never auto-delete.
| Parameter | Type | Description |
|---|---|---|
symbol * | string | |
output_format | string | text returns concise TextContent; json also returns the stable structuredContent envelope |
change_signature
Add or remove a function/method parameter (JS/TS) with byte-exact call-site argument surgery. Always PARTIAL (call sites from graph edges); spread/value-add reported UNCERTAIN. operation: {kind:"add_parameter",name,default?} | {kind:"remove_parameter",index}.
| Parameter | Type | Description |
|---|---|---|
operation * | object | |
symbol * | string | |
output_format | string | text returns concise TextContent; json also returns the stable structuredContent envelope |
edit_symbol
Symbol-anchored edit over the parser source range (all languages): replace_symbol_body | insert_before_symbol | insert_after_symbol. JS/TS results are parse-gated.
| Parameter | Type | Description |
|---|---|---|
content * | string | |
operation * | string | |
symbol * | string | |
output_format | string | text returns concise TextContent; json also returns the stable structuredContent envelope |
bulk_replace
Two-stage occurrence-selective pattern replace over the indexed universe. Preview (no selection) returns stable occurrence ids; then pass occurrence_ids or expected_count to plan. literal:true by default.
| Parameter | Type | Description |
|---|---|---|
pattern * | string | |
replacement * | string | |
expected_count | integer | |
flags | string | |
literal | boolean | |
occurrence_ids | array | |
output_format | string | text returns concise TextContent; json also returns the stable structuredContent envelope |
path_prefix | string |
organize_imports
Removes provably-unused named imports from a JS/TS file (a binding is removed only when its name occurs once in the file). Default/namespace imports are reported UNCERTAIN, never removed; sorting is left to the formatter.
| Parameter | Type | Description |
|---|---|---|
file * | string | |
output_format | string | text returns concise TextContent; json also returns the stable structuredContent envelope |