Skip to content

fix_inspection

MCP tools › Code insight and refactoring

Apply the quick fix of one finding of Ferris IDEA's own inspections (inspect_code names it), by file, 0-based line and column and inspection id; all fixes every finding of that inspection in the file, overlaps skipped. With several fixes at a place title picks one, else the first. Grammar findings also offer Ignore '<text>', Disable rule '<name>' and Apply all writing suggestions in file; a key missing in its resource bundle offers Add missing translation to <locales>. Dry run by default: returns title, count, edits and new text; dry_run=false writes, refusing if the file changed.

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

Capabilitycode.fix_inspection
AreaCode insight and refactoring
Accesschanges files
Reachesprocess
Rightswrite, trusted-project
Dry rundry_run, on unless the call turns it off

Arguments

ArgumentTypeDescription
pathrequiredstringWorkspace-relative file.
lineinteger0-based line of the finding, as inspect_code returns it (not needed with all).minimum 0
columninteger0-based column of the finding, as inspect_code returns it (not needed with all).minimum 0
idrequiredstringInspection id, e.g. java.unused-import.
allbooleanFix every finding of this inspection in the file (default false).default false
titlestringThe fix to apply when the place has several (its title as inspect_code names it, e.g. Remove statement); default the first.
dry_runbooleanOnly return the edits and the new text (default true).

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 fix_inspection '{"path":"<string>","id":"<string>"}'
Input schema as JSON
{
"type": "object",
"required": [
"path",
"id"
],
"properties": {
"path": {
"description": "Workspace-relative file.",
"type": "string"
},
"line": {
"description": "0-based line of the finding, as `inspect_code` returns it (not needed with `all`).",
"type": [
"integer",
"null"
],
"default": null,
"minimum": 0
},
"column": {
"description": "0-based column of the finding, as `inspect_code` returns it (not needed with `all`).",
"type": [
"integer",
"null"
],
"default": null,
"minimum": 0
},
"id": {
"description": "Inspection id, e.g. `java.unused-import`.",
"type": "string"
},
"all": {
"description": "Fix every finding of this inspection in the file (default false).",
"type": "boolean",
"default": false
},
"title": {
"description": "The fix to apply when the place has several (its title as `inspect_code` names it, e.g.\n`Remove statement`); default the first.",
"type": [
"string",
"null"
],
"default": null
},
"dry_run": {
"description": "Only return the edits and the new text (default true).",
"type": [
"boolean",
"null"
]
}
}
}