batch_refactor
Apply a refactor instruction to every file matching a glob pattern. Review diffs with dry run before writing changes.
Instructions
Apply a refactor instruction to every file matching a glob pattern, sequentially.
glob_pattern matches relative paths under root_dir (default: the
server's allowed base directory), e.g. "src/**/*.py". Files are
processed one at a time against the local model. With dry_run=True
(the default) nothing is written -- you get a unified diff per file to
review first; set dry_run=False to write accepted changes to disk.
Large match sets are capped (see OLLAMA_MCP_MAX_BATCH_FILES) to avoid
runaway sequential runs.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"glob_pattern": "<glob_pattern>",
"instruction": "<instruction>"
},
"name": "batch_refactor"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| think | No | ||
| dry_run | No | ||
| root_dir | No | ||
| instruction | Yes | ||
| glob_pattern | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |