Skip to content

replace_in_files_preview

MCP tools › Code insight and refactoring

Preview a find-and-replace across the project's own source files: per file the replacements (line, old, new) and the number of changes. Nothing is written. Files that are not the project's own (virtual environments, installed dependencies, build output, ignored files) are changed only with include_non_project; without it a directory such as .venv/lib lists them under not_changed with the reason.

Its results carry text from files, language_server: the client is told to treat that as data, never as instructions.

Capabilitycode.replace_in_files_preview
AreaCode insight and refactoring
Accessreads only
Reaches—
Rightsnone
Dry runnone

Arguments

ArgumentTypeDescription
patternrequiredstringText or regular expression.
replacementrequiredstringReplacement; with regex $1, ${name} and $$ are expanded.
regexbooleanTreat the pattern as a regular expression (default false).
match_casebooleanMatch case (default false).
whole_wordsbooleanWhole words only (default false).
file_maskstringComma-separated file-name globs (default: all files).
directorystringOnly files below this workspace-relative folder or file.
include_non_projectbooleanAlso replace in files that are not the project's own sources: virtual environments, installed dependencies, build output, ignored files (default false; SPEC-0029 v2 behaviour 9). Without it such files are listed under not_changed.

Call it from a shell

ferris-idea call runs one tool with the rights and safe mode of ferris-idea mcp. Replace the folder and the placeholder values.

Terminal window
ferris-idea call ~/my-project replace_in_files_preview '{"pattern":"<string>","replacement":"<string>"}'
Input schema as JSON
{
"type": "object",
"required": [
"pattern",
"replacement"
],
"properties": {
"pattern": {
"description": "Text or regular expression.",
"type": "string"
},
"replacement": {
"description": "Replacement; with regex `$1`, `${name}` and `$$` are expanded.",
"type": "string"
},
"regex": {
"description": "Treat the pattern as a regular expression (default false).",
"type": [
"boolean",
"null"
]
},
"match_case": {
"description": "Match case (default false).",
"type": [
"boolean",
"null"
]
},
"whole_words": {
"description": "Whole words only (default false).",
"type": [
"boolean",
"null"
]
},
"file_mask": {
"description": "Comma-separated file-name globs (default: all files).",
"type": [
"string",
"null"
]
},
"directory": {
"description": "Only files below this workspace-relative folder or file.",
"type": [
"string",
"null"
]
},
"include_non_project": {
"description": "Also replace in files that are not the project's own sources: virtual environments,\ninstalled dependencies, build output, ignored files (default false; SPEC-0029 v2\nbehaviour 9). Without it such files are listed under `not_changed`.",
"type": [
"boolean",
"null"
]
}
}
}