Skip to content

compare_files

MCP tools › Workspace and files

Compare two workspace files as the diff viewer does: differences, rows (left/right line and text, changed word ranges) and changes (1-based inclusive line ranges; an empty range has end = start - 1); unified=true adds the unified view. With apply (a change index) and take (left or right) it accepts that side into the other file, returning target and its new text. Dry run by default; dry_run=false needs the write right and is refused for a read-only target. Open files are compared as the editor shows them; an open target changes as one undo step. Folders and non-text files are errors.

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

Capabilityworkspace.compare_files
AreaWorkspace and files
Accesschanges files
Reaches—
Rightswrite
Dry rundry_run, on unless the call turns it off

Arguments

ArgumentTypeDescription
leftrequiredstringWorkspace-relative path of the file shown on the left.
rightrequiredstringWorkspace-relative path of the file shown on the right.
unifiedbooleanAlso return unified: the rows of the unified view (kind, old, new, text).
applyintegerThe 1-based index of the change (of changes) to take over; needs take.minimum 0
takestringleft or right: the side whose lines are taken; the other file is the one that changes.
dry_runbooleanDefault true: only say what the other file would become.

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 compare_files '{"left":"<string>","right":"<string>"}'
Input schema as JSON
{
"type": "object",
"required": [
"left",
"right"
],
"properties": {
"left": {
"description": "Workspace-relative path of the file shown on the left.",
"type": "string"
},
"right": {
"description": "Workspace-relative path of the file shown on the right.",
"type": "string"
},
"unified": {
"description": "Also return `unified`: the rows of the unified view (kind, old, new, text).",
"type": [
"boolean",
"null"
]
},
"apply": {
"description": "The 1-based `index` of the change (of `changes`) to take over; needs `take`.",
"type": [
"integer",
"null"
],
"minimum": 0
},
"take": {
"description": "`left` or `right`: the side whose lines are taken; the other file is the one that changes.",
"type": [
"string",
"null"
]
},
"dry_run": {
"description": "Default true: only say what the other file would become.",
"type": [
"boolean",
"null"
]
}
}
}