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.
| Capability | code.safe_delete |
|---|---|
| Area | Code insight and refactoring |
| Access | changes files |
| Reaches | process |
| Rights | write |
| Dry run | dry_run, on unless the call turns it off |
Arguments
| Argument | Type | Description |
|---|---|---|
pathrequired | string | Workspace-relative file path. |
linerequired | integer | 0-based line of the symbol (its declaration or a usage).minimum 0 |
characterrequired | integer | 0-based character in the line (Unicode scalar values).minimum 0 |
dry_run | boolean | Only report the declaration, the usages and the text after the deletion (default true). |
force | boolean | Delete 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.
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" ] } }}