Skip to content

ollama_multi_file_refactor_propose

Propose multi-file refactor. REFACTOR. Coordinated multi-file refactor PLAN — NO WRITES. Server reads each file in files (1-20 paths, path validation via SOURCE_PATH_NOT_FOUND), hands the bodies + change_description to the Workhorse tier, and returns {per_file_changes:[{file, before_summary, after_summary, risk_level, change_kinds[]}], cross_file_impact, affected_imports:[{from, to, files[]}], verification_steps, weak}. change_kinds are normalized from {rename, signature-change, import-update, move, delete, new}. Files the model invents (not in input) are stripped. Thin output → weak=true. Use BEFORE touching files so Claude can see a coordinated plan. Pair with ollama_refactor_plan for sequencing and ollama_batch_proof_check for verification.

Parameter Type Required Default Description
files any yes Source file paths the refactor touches. Server reads them — Claude does not preload. Min 1, max 20.
change_description string yes What the refactor should accomplish, in 20-2000 chars. Be specific — vague descriptions produce vague plans (likely weak=true).
per_file_max_chars integer no Chars to read per file (default 60_000).

The JSON Schema below is generated from the same zod schema the server validates against at the wire — it cannot drift from runtime behavior.

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"files": {
"description": "Source file paths the refactor touches. Server reads them — Claude does not preload. Min 1, max 20."
},
"change_description": {
"type": "string",
"minLength": 20,
"maxLength": 2000,
"description": "What the refactor should accomplish, in 20-2000 chars. Be specific — vague descriptions produce vague plans (likely weak=true)."
},
"per_file_max_chars": {
"description": "Chars to read per file (default 60_000).",
"type": "integer",
"minimum": 1000,
"maximum": 200000
}
},
"required": [
"files",
"change_description"
]
}

Every tool returns the standard envelope — tier_used, model, tokens_in/tokens_out, elapsed_ms, backend provenance, warnings. See Envelope & tiers.

Schema + handler: src/tools/multiFileRefactorPropose.ts · registration: src/index.ts


Back to the Tool Reference.