Skip to content

safe_delete

MCP tools › Code insight and refactoring

Safe Delete of the symbol at a position of a workspace file: finds usages as find_usages does and removes the declaration's whole lines with the comment, doc and annotation lines above it. Returns declaration (0-based lines), usages, source, applied, refused and the file's resulting text. Locals, parameters and declarations sharing a line with other code are errors. Dry run by default; dry_run=false deletes only without usages or with force, as one undo step in the open editor or on disk (refused 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.safe_delete
AreaCode insight and refactoring
Accesschanges files
Reachesprocess
Rightswrite
Dry rundry_run, on unless the call turns it off

Arguments

ArgumentTypeDescription
pathrequiredstringWorkspace-relative file path.
linerequiredinteger0-based line of the symbol (its declaration or a usage).minimum 0
characterrequiredinteger0-based character in the line (Unicode scalar values).minimum 0
dry_runbooleanOnly report the declaration, the usages and the text after the deletion (default true).
forcebooleanDelete although usages were found (default false).

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 safe_delete '{"path":"<string>","line":1,"character":1}'
Input schema as JSON
{
"type": "object",
"required": [
"path",
"line",
"character"
],
"properties": {
"path": {
"description": "Workspace-relative file path.",
"type": "string"
},
"line": {
"description": "0-based line of the symbol (its declaration or a usage).",
"type": "integer",
"minimum": 0
},
"character": {
"description": "0-based character in the line (Unicode scalar values).",
"type": "integer",
"minimum": 0
},
"dry_run": {
"description": "Only report the declaration, the usages and the text after the deletion (default true).",
"type": [
"boolean",
"null"
]
},
"force": {
"description": "Delete although usages were found (default false).",
"type": [
"boolean",
"null"
]
}
}
}