Skip to content

editor_keystrokes

MCP tools › Window and UI driver

Press keystrokes in an editor on a workspace file, as the editor view does: each keystroke (keymap notation such as meta shift UP, alt UP, BACK_SPACE) is looked up in the bundled default or macOS keymap and the first editor command bound to it is carried out (Editor… actions first, as in a focused editor) (caret motion, smart Home, page moves, selection stages, copy/cut/paste with whole lines, indentation, line commands, undo/redo); a step with text types it. Returns per step the bound actions and the one carried out, and the final text and carets (1-based); the file is not written.

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

Capabilityui.editor_keystrokes
AreaWindow and UI driver
Accessreads only
Reaches—
Rightsnone
Dry runnone

Arguments

ArgumentTypeDescription
pathrequiredstringWorkspace-relative file.
caretsarray of objectCarets and selections (default: one caret at 1:1).
carets[].linerequiredintegerLine of the caret (selection end).minimum 0
carets[].columnrequiredintegerColumn of the caret.minimum 0
carets[].anchor_lineintegerLine where the selection starts (default: no selection).minimum 0
carets[].anchor_columnintegerColumn where the selection starts.minimum 0
stepsrequiredarray of objectKeystrokes and texts, pressed in order.
steps[].keysstringKeystroke in keymap notation, e.g. meta shift UP, alt UP, BACK_SPACE.
steps[].textstringText typed instead of a keystroke.
keymapstringdefault (Windows/Linux, the default) or macos.
indentstringIndentation step (default four spaces).
viewport_linesintegerVisible lines for page commands (default 40).minimum 0

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 editor_keystrokes '{"path":"<string>","steps":[]}'
Input schema as JSON
{
"properties": {
"path": {
"description": "Workspace-relative file.",
"type": "string"
},
"carets": {
"description": "Carets and selections (default: one caret at 1:1).",
"type": "array",
"items": {
"$ref": "#/$defs/CaretArg"
}
},
"steps": {
"description": "Keystrokes and texts, pressed in order.",
"type": "array",
"items": {
"$ref": "#/$defs/KeyStep"
}
},
"keymap": {
"description": "`default` (Windows/Linux, the default) or `macos`.",
"type": [
"string",
"null"
]
},
"indent": {
"description": "Indentation step (default four spaces).",
"type": [
"string",
"null"
]
},
"viewport_lines": {
"description": "Visible lines for page commands (default 40).",
"type": [
"integer",
"null"
],
"minimum": 0
}
},
"$defs": {
"CaretArg": {
"description": "A caret or selection for `editor_action` (1-based line and column, in characters).",
"type": "object",
"properties": {
"line": {
"description": "Line of the caret (selection end).",
"type": "integer",
"minimum": 0
},
"column": {
"description": "Column of the caret.",
"type": "integer",
"minimum": 0
},
"anchor_line": {
"description": "Line where the selection starts (default: no selection).",
"type": [
"integer",
"null"
],
"minimum": 0
},
"anchor_column": {
"description": "Column where the selection starts.",
"type": [
"integer",
"null"
],
"minimum": 0
}
},
"required": [
"line",
"column"
]
},
"KeyStep": {
"description": "One step of `editor_keystrokes`: a keystroke or a text to type.",
"type": "object",
"properties": {
"keys": {
"description": "Keystroke in keymap notation, e.g. `meta shift UP`, `alt UP`, `BACK_SPACE`.",
"type": [
"string",
"null"
]
},
"text": {
"description": "Text typed instead of a keystroke.",
"type": [
"string",
"null"
]
}
}
}
},
"required": [
"path",
"steps"
],
"type": "object"
}