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.
| Capability | ui.editor_keystrokes |
|---|---|
| Area | Window and UI driver |
| Access | reads only |
| Reaches | — |
| Rights | none |
| Dry run | none |
Arguments
| Argument | Type | Description |
|---|---|---|
pathrequired | string | Workspace-relative file. |
carets | array of object | Carets and selections (default: one caret at 1:1). |
carets[].linerequired | integer | Line of the caret (selection end).minimum 0 |
carets[].columnrequired | integer | Column of the caret.minimum 0 |
carets[].anchor_line | integer | Line where the selection starts (default: no selection).minimum 0 |
carets[].anchor_column | integer | Column where the selection starts.minimum 0 |
stepsrequired | array of object | Keystrokes and texts, pressed in order. |
steps[].keys | string | Keystroke in keymap notation, e.g. meta shift UP, alt UP, BACK_SPACE. |
steps[].text | string | Text typed instead of a keystroke. |
keymap | string | default (Windows/Linux, the default) or macos. |
indent | string | Indentation step (default four spaces). |
viewport_lines | integer | Visible 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.
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"}