Skip to main content
Glama

keyboard

Send text, key combos, or multi-step sequences to a specified window with automatic focus guarding. Use type for text, press for shortcuts, sequence for atomic menu navigation.

Instructions

Purpose: Send keyboard input to a window: 'type' for text, 'press' for key combos, 'sequence' for atomic multi-step chords. Details: action='type' inserts text (auto-clipboard for non-ASCII, bypassing IME conversion). action='press' sends key combos like 'ctrl+c'/'alt+tab'. action='sequence' runs ordered steps in one keyboard lock — use for Alt+letter, letter mnemonic chains where intermediate tool calls would close the menu. windowTitle or hwnd is REQUIRED (blank/whitespace counts as neither) — the server focuses and auto-guards that window (identity, foreground, modal) first, and a call with neither stops with DestinationRequired before any key is sent. Use windowTitle:'@active' to aim at the foreground window on purpose; an hwnd naming a titleless window works only while that window is already foreground. DESKTOP_TOUCH_REQUIRE_DESTINATION=0 downgrades the stop to a warning. Prefer: Set lensId for perception guards. Use desktop_act({action:'setValue'}) for UIA ValuePattern text fields. Caveats: win+r/win+x/win+s/win+l blocked. action='type' does not handle CJK IME composition — use use_clipboard=true or desktop_act({action:'setValue'}); neither lands while an IME composition is pending — commit or cancel it first. hints.clipboard reports the backend and whether the clipboard was restored. Non-ASCII text (CJK / emoji / diacritics / smart-quote-class punctuation) auto-clipboards to prevent silent-drop and Chrome accelerator hijack; pass forceKeystrokes:true to disable. Background (PostMessage/WM_CHAR) auto-engages for terminal-class windows (Windows Terminal / cmd / PowerShell); DTM_BG_AUTO=1 enables globally. Foreground non-terminal type runs a per-chunk leash; user focus-steal mid-stream aborts with FocusLostDuringType + context.typed/remaining; pass abortOnFocusLoss:false to disable. BG type verifies WM_CHAR via UIA TextPattern read-back; mismatch returns BackgroundInputNotDelivered (see SUGGESTS for false-positive notes). BG press read-back is scoped to terminal-class + enter/tab/arrow; other combos return verifyDelivery:'unverifiable', failure returns BackgroundKeyNotDelivered. action='sequence' is FG-only (BG/foreground_flash schema-rejected); emits verifyDelivery:'focus_only'; mid-loop focus theft returns MenuFocusLostMidSequence + context.remaining: Step[]. Win11 FG refusal returns ForegroundRestricted — terminal-class targets auto-engage BG; non-terminal switch to desktop_act / click_element. Examples: keyboard({action:'type', text:'hello', windowTitle:'Untitled - Notepad'}) → text injected (guarded) keyboard({action:'type', text:'hello', windowTitle:'@active'}) → typed into the foreground window keyboard({action:'press', keys:'ctrl+c', windowTitle:'Untitled - Notepad'}) → copy keyboard({action:'press', keys:'escape', windowTitle:'Dialog'}) → dismiss dialog keyboard({action:'sequence', steps:[{keys:'alt+i', gapMs:100},{keys:'m'}], windowTitle:'Microsoft Visual Basic'}) → Insert > Module (atomic)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hwndNoDirect window handle ID (takes precedence over windowTitle). Obtain from get_windows response (hwnd field). String type to avoid 64-bit precision issues.
keysNoKey combo string, e.g. 'ctrl+c', 'alt+tab', 'enter', 'ctrl+shift+s'. Note: win+r, win+x, win+s, win+l are blocked for security.
textNoThe text to type (max 10,000 characters)
fixIdNoApprove a pending suggestedFix (one-shot, 15s TTL). Pass the fixId returned by a previous failed keyboard(action='type') to re-attempt with guard-validated args.
stepsNoOrdered list of key-press steps. Min 1, max 16. Total duration must not exceed 5000ms (excludes settleMs and focus acquisition). N=1 is allowed but inherits the sequence verification contract (hints.verifyDelivery.status='focus_only'); if you want the stricter keyboard:press contract, call keyboard({action:'press', keys}) directly (issue #278, matrix doc §3.1).
actionYesAction selector — one of: type, press, sequence. Per-action required fields are enforced at call time (see the tool description); this flat schema lists every action's fields as optional.
lensIdNoOptional perception lens ID. Guards (safe.keyboardTarget) are evaluated before typing, and a perception envelope is attached to post.perception on success.
methodNoInput method. background = WM_CHAR PostMessage (no focus change); foreground = SendInput (current default); auto = pick automatically.auto
includeNoOptional response-shape opt-in. `['envelope']` returns the self-documenting envelope (`_version` / `data` / `as_of` / `confidence`). `['raw']` forces raw shape (overrides DESKTOP_TOUCH_ENVELOPE=1 server default). Default behaviour is raw shape (compat with existing clients).
narrateNoNarration level. rich includes UIA or browser state diff when supported.minimal
settleMsNoMilliseconds to wait before checking post-action state.
forceFocusNoBypass Windows foreground-stealing protection before focusing.
replaceAllNoWhen true, send Ctrl+A to select all existing text before typing. Equivalent to Ctrl+A → keyboard(action='type') in one call (requires field already focused). Default false.
trackFocusNoDetect if focus was stolen after the action.
forceImeOffNoIssue #245 系統②: when true, query the target window's IME open-status via Imm32 before typing; if ON, switch OFF for the duration of this call and restore the prior state in `finally`. Prevents silent romaji conversion when the user's Japanese IME is active but the LLM is typing ASCII commands. Requires `windowTitle` or `hwnd` (otherwise no target to query). Default false — existing use_clipboard auto-promotion still handles non-ASCII symbols transparently. No-op when the addon predates the IMM bridge (call proceeds with whatever IME state is in effect).
windowTitleNoPartial title of the window that should receive keyboard input.
use_clipboardNoIf true, copy text to clipboard and paste with Ctrl+V instead of simulating keystrokes. Use this when typing URLs, paths, or ASCII text into apps with Japanese IME active — pasted text is not run through IME conversion. Note this does not help while an IME composition is already in progress: the paste keystroke is consumed by the IME and nothing is inserted, so commit or cancel the composition first. Your clipboard is replaced for the duration of the call and put back afterwards; hints.clipboard reports which backend served the paste and whether the restore ran. On builds without the native addon this path is capped at about 12000 characters and fails with code:'ClipboardWriteTooLargeForFallback' above it. Default false.
forceKeystrokesNoWhen true, always use keystroke mode even if text contains non-ASCII content (CJK, emoji, diacritics, em-dash, smart quotes, etc.) that would normally trigger auto-clipboard. Default false — auto-clipboard is enabled.
abortOnFocusLossNoFocus Leash Phase B: when true, the foreground keystroke send is split into chunks (default 8 chars; override via DTM_LEASH_CHUNK_SIZE env) and the target window's foreground state is verified between chunks. If the user grabs focus mid-stream, the call aborts and returns FocusLostDuringType with context.typed (chars delivered to target) and context.remaining (unsent tail) so the caller can re-focus and retry the unsent portion. Default: true when windowTitle is provided, false otherwise. Has no effect on the clipboard path (atomic Ctrl+V) or the BG (WM_CHAR) path (HWND-targeted, foreground-independent).

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed1 schema field changedv1.14.3
    • changedInput schema / properties / use_clipboard / description
      Previous value: -"If true, copy text to clipboard and paste with Ctrl+V instead of simulating keystrokes. Use this when typing URLs, paths, or ASCII text into apps with Japanese IME active — prevents IME from converting characters. Default false."New value: +"If true, copy text to clipboard and paste with Ctrl+V instead of simulating keystrokes. Use this when typing URLs, paths, or ASCII text into apps with Japanese IME active — pasted text is not run through IME conversion. Note this does not help while an IME composition is already in progress: the paste keystroke is consumed by the IME and nothing is inserted, so commit or cancel the composition first. Your clipboard is replaced for the duration of the call and put back afterwards; hints.clipboard reports which backend served the paste and whether the restore ran. On builds without the native addon this path is capped at about 12000 characters and fails with code:'ClipboardWriteTooLargeForFallback' above it. Default false."
  2. Addedv1.12.0
  3. Removedv1.10.4
  4. Addedv1.9.2
  5. Removedv1.8.0
  6. Addedv1.6.0
  7. Removedv1.5.1
  8. Addedv1.5.0
  9. Removedv1.4.3
  10. Addedv1.4.2
  11. Removedv1.4.0
  12. Changed1 schema field changedv1.2.1
    • changedInput schema / oneOf
      Previous value: -[
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "abortOnFocusLoss": {
      -        "description": "Focus Leash Phase B: when true, the foreground keystroke send is split into chunks (default 8 chars; override via DTM_LEASH_CHUNK_SIZE env) and the target window's foreground state is verified between chunks. If the user grabs focus mid-stream, the call aborts and returns FocusLostDuringType with context.typed (chars delivered to target) and context.remaining (unsent tail) so the caller can re-focus and retry the unsent portion. Default: true when windowTitle is provided, false otherwise. Has no effect on the clipboard path (atomic Ctrl+V) or the BG (WM_CHAR) path (HWND-targeted, foreground-independent).",
      -        "type": "boolean"
      -      },
      -      "action": {
      -        "const": "type"
      -      },
      -      "fixId": {
      -        "description": "Approve a pending suggestedFix (one-shot, 15s TTL). Pass the fixId returned by a previous failed keyboard(action='type') to re-attempt with guard-validated args.",
      -        "type": "string"
      -      },
      -      "forceFocus": {
      -        "description": "Bypass Windows foreground-stealing protection before focusing.",
      -        "type": "boolean"
      -      },
      -      "forceKeystrokes": {
      -        "default": false,
      -        "description": "When true, always use keystroke mode even if text contains non-ASCII symbols (em-dash, en-dash, smart quotes, etc.) that would normally trigger auto-clipboard. Default false — auto-clipboard is enabled.",
      -        "type": "boolean"
      -      },
      -      "hwnd": {
      -        "description": "Direct window handle ID (takes precedence over windowTitle). Obtain from get_windows response (hwnd field). String type to avoid 64-bit precision issues.",
      -        "type": "string"
      -      },
      -      "lensId": {
      -        "description": "Optional perception lens ID. Guards (safe.keyboardTarget) are evaluated before typing, and a perception envelope is attached to post.perception on success.",
      -        "type": "string"
      -      },
      -      "method": {
      -        "default": "auto",
      -        "description": "Input method. background = WM_CHAR PostMessage (no focus change); foreground = SendInput (current default); auto = pick automatically.",
      -        "enum": [
      -          "auto",
      -          "background",
      -          "foreground"
      -        ],
      -        "type": "string"
      -      },
      -      "narrate": {
      -        "default": "minimal",
      -        "description": "Narration level. rich includes UIA or browser state diff when supported.",
      -        "enum": [
      -          "minimal",
      -          "rich"
      -        ],
      -        "type": "string"
      -      },
      -      "replaceAll": {
      -        "default": false,
      -        "description": "When true, send Ctrl+A to select all existing text before typing. Equivalent to Ctrl+A → keyboard(action='type') in one call (requires field already focused). Default false.",
      -        "type": "boolean"
      -      },
      -      "settleMs": {
      -        "default": 300,
      -        "description": "Milliseconds to wait before checking post-action state.",
      -        "maximum": 2000,
      -        "minimum": 0,
      -        "type": "integer"
      -      },
      -      "text": {
      -        "description": "The text to type (max 10,000 characters)",
      -        "maxLength": 10000,
      -        "type": "string"
      -      },
      -      "trackFocus": {
      -        "default": true,
      -        "description": "Detect if focus was stolen after the action.",
      -        "type": "boolean"
      -      },
      -      "use_clipboard": {
      -        "default": false,
      -        "description": "If true, copy text to clipboard and paste with Ctrl+V instead of simulating keystrokes. Use this when typing URLs, paths, or ASCII text into apps with Japanese IME active — prevents IME from converting characters. Default false.",
      -        "type": "boolean"
      -      },
      -      "windowTitle": {
      -        "description": "Partial title of the window that should receive keyboard input.",
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "action",
      -      "text"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "action": {
      -        "const": "press"
      -      },
      -      "forceFocus": {
      -        "description": "Bypass Windows foreground-stealing protection before focusing.",
      -        "type": "boolean"
      -      },
      -      "hwnd": {
      -        "description": "Direct window handle ID (takes precedence over windowTitle). Obtain from get_windows response (hwnd field). String type to avoid 64-bit precision issues.",
      -        "type": "string"
      -      },
      -      "keys": {
      -        "description": "Key combo string, e.g. 'ctrl+c', 'alt+tab', 'enter', 'ctrl+shift+s'. Note: win+r, win+x, win+s, win+l are blocked for security.",
      -        "maxLength": 100,
      -        "type": "string"
      -      },
      -      "lensId": {
      -        "description": "Optional perception lens ID. Guards (safe.keyboardTarget) are evaluated before the key press.",
      -        "type": "string"
      -      },
      -      "method": {
      -        "default": "auto",
      -        "description": "Input method. background = WM_CHAR PostMessage (no focus change); foreground = SendInput (current default); auto = pick automatically.",
      -        "enum": [
      -          "auto",
      -          "background",
      -          "foreground"
      -        ],
      -        "type": "string"
      -      },
      -      "narrate": {
      -        "default": "minimal",
      -        "description": "Narration level. rich includes UIA or browser state diff when supported.",
      -        "enum": [
      -          "minimal",
      -          "rich"
      -        ],
      -        "type": "string"
      -      },
      -      "settleMs": {
      -        "default": 300,
      -        "description": "Milliseconds to wait before checking post-action state.",
      -        "maximum": 2000,
      -        "minimum": 0,
      -        "type": "integer"
      -      },
      -      "trackFocus": {
      -        "default": true,
      -        "description": "Detect if focus was stolen after the action.",
      -        "type": "boolean"
      -      },
      -      "windowTitle": {
      -        "description": "Partial title of the window that should receive keyboard input.",
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "action",
      -      "keys"
      -    ],
      -    "type": "object"
      -  }
      -]New value: +[
      +  {
      +    "additionalProperties": false,
      +    "properties": {
      +      "abortOnFocusLoss": {
      +        "description": "Focus Leash Phase B: when true, the foreground keystroke send is split into chunks (default 8 chars; override via DTM_LEASH_CHUNK_SIZE env) and the target window's foreground state is verified between chunks. If the user grabs focus mid-stream, the call aborts and returns FocusLostDuringType with context.typed (chars delivered to target) and context.remaining (unsent tail) so the caller can re-focus and retry the unsent portion. Default: true when windowTitle is provided, false otherwise. Has no effect on the clipboard path (atomic Ctrl+V) or the BG (WM_CHAR) path (HWND-targeted, foreground-independent).",
      +        "type": "boolean"
      +      },
      +      "action": {
      +        "const": "type"
      +      },
      +      "fixId": {
      +        "description": "Approve a pending suggestedFix (one-shot, 15s TTL). Pass the fixId returned by a previous failed keyboard(action='type') to re-attempt with guard-validated args.",
      +        "type": "string"
      +      },
      +      "forceFocus": {
      +        "description": "Bypass Windows foreground-stealing protection before focusing.",
      +        "type": "boolean"
      +      },
      +      "forceKeystrokes": {
      +        "default": false,
      +        "description": "When true, always use keystroke mode even if text contains non-ASCII symbols (em-dash, en-dash, smart quotes, etc.) that would normally trigger auto-clipboard. Default false — auto-clipboard is enabled.",
      +        "type": "boolean"
      +      },
      +      "hwnd": {
      +        "description": "Direct window handle ID (takes precedence over windowTitle). Obtain from get_windows response (hwnd field). String type to avoid 64-bit precision issues.",
      +        "type": "string"
      +      },
      +      "include": {
      +        "description": "Optional response-shape opt-in. `['envelope']` returns the self-documenting envelope (`_version` / `data` / `as_of` / `confidence`). `['raw']` forces raw shape (overrides DESKTOP_TOUCH_ENVELOPE=1 server default). Default behaviour is raw shape (compat with existing clients).",
      +        "items": {
      +          "type": "string"
      +        },
      +        "type": "array"
      +      },
      +      "lensId": {
      +        "description": "Optional perception lens ID. Guards (safe.keyboardTarget) are evaluated before typing, and a perception envelope is attached to post.perception on success.",
      +        "type": "string"
      +      },
      +      "method": {
      +        "default": "auto",
      +        "description": "Input method. background = WM_CHAR PostMessage (no focus change); foreground = SendInput (current default); auto = pick automatically.",
      +        "enum": [
      +          "auto",
      +          "background",
      +          "foreground"
      +        ],
      +        "type": "string"
      +      },
      +      "narrate": {
      +        "default": "minimal",
      +        "description": "Narration level. rich includes UIA or browser state diff when supported.",
      +        "enum": [
      +          "minimal",
      +          "rich"
      +        ],
      +        "type": "string"
      +      },
      +      "replaceAll": {
      +        "default": false,
      +        "description": "When true, send Ctrl+A to select all existing text before typing. Equivalent to Ctrl+A → keyboard(action='type') in one call (requires field already focused). Default false.",
      +        "type": "boolean"
      +      },
      +      "settleMs": {
      +        "default": 300,
      +        "description": "Milliseconds to wait before checking post-action state.",
      +        "maximum": 2000,
      +        "minimum": 0,
      +        "type": "integer"
      +      },
      +      "text": {
      +        "description": "The text to type (max 10,000 characters)",
      +        "maxLength": 10000,
      +        "type": "string"
      +      },
      +      "trackFocus": {
      +        "default": true,
      +        "description": "Detect if focus was stolen after the action.",
      +        "type": "boolean"
      +      },
      +      "use_clipboard": {
      +        "default": false,
      +        "description": "If true, copy text to clipboard and paste with Ctrl+V instead of simulating keystrokes. Use this when typing URLs, paths, or ASCII text into apps with Japanese IME active — prevents IME from converting characters. Default false.",
      +        "type": "boolean"
      +      },
      +      "windowTitle": {
      +        "description": "Partial title of the window that should receive keyboard input.",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "action",
      +      "text"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "additionalProperties": false,
      +    "properties": {
      +      "action": {
      +        "const": "press"
      +      },
      +      "forceFocus": {
      +        "description": "Bypass Windows foreground-stealing protection before focusing.",
      +        "type": "boolean"
      +      },
      +      "hwnd": {
      +        "description": "Direct window handle ID (takes precedence over windowTitle). Obtain from get_windows response (hwnd field). String type to avoid 64-bit precision issues.",
      +        "type": "string"
      +      },
      +      "include": {
      +        "description": "Optional response-shape opt-in. `['envelope']` returns the self-documenting envelope (`_version` / `data` / `as_of` / `confidence`). `['raw']` forces raw shape (overrides DESKTOP_TOUCH_ENVELOPE=1 server default). Default behaviour is raw shape (compat with existing clients).",
      +        "items": {
      +          "type": "string"
      +        },
      +        "type": "array"
      +      },
      +      "keys": {
      +        "description": "Key combo string, e.g. 'ctrl+c', 'alt+tab', 'enter', 'ctrl+shift+s'. Note: win+r, win+x, win+s, win+l are blocked for security.",
      +        "maxLength": 100,
      +        "type": "string"
      +      },
      +      "lensId": {
      +        "description": "Optional perception lens ID. Guards (safe.keyboardTarget) are evaluated before the key press.",
      +        "type": "string"
      +      },
      +      "method": {
      +        "default": "auto",
      +        "description": "Input method. background = WM_CHAR PostMessage (no focus change); foreground = SendInput (current default); auto = pick automatically.",
      +        "enum": [
      +          "auto",
      +          "background",
      +          "foreground"
      +        ],
      +        "type": "string"
      +      },
      +      "narrate": {
      +        "default": "minimal",
      +        "description": "Narration level. rich includes UIA or browser state diff when supported.",
      +        "enum": [
      +          "minimal",
      +          "rich"
      +        ],
      +        "type": "string"
      +      },
      +      "settleMs": {
      +        "default": 300,
      +        "description": "Milliseconds to wait before checking post-action state.",
      +        "maximum": 2000,
      +        "minimum": 0,
      +        "type": "integer"
      +      },
      +      "trackFocus": {
      +        "default": true,
      +        "description": "Detect if focus was stolen after the action.",
      +        "type": "boolean"
      +      },
      +      "windowTitle": {
      +        "description": "Partial title of the window that should receive keyboard input.",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "action",
      +      "keys"
      +    ],
      +    "type": "object"
      +  }
      +]
  13. Changed1 schema field changedv1.1.0
    • changedInput schema / oneOf
      Previous value: -[
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "action": {
      -        "const": "type"
      -      },
      -      "fixId": {
      -        "description": "Approve a pending suggestedFix (one-shot, 15s TTL). Pass the fixId returned by a previous failed keyboard(action='type') to re-attempt with guard-validated args.",
      -        "type": "string"
      -      },
      -      "forceFocus": {
      -        "description": "Bypass Windows foreground-stealing protection before focusing.",
      -        "type": "boolean"
      -      },
      -      "forceKeystrokes": {
      -        "default": false,
      -        "description": "When true, always use keystroke mode even if text contains non-ASCII symbols (em-dash, en-dash, smart quotes, etc.) that would normally trigger auto-clipboard. Default false — auto-clipboard is enabled.",
      -        "type": "boolean"
      -      },
      -      "hwnd": {
      -        "description": "Direct window handle ID (takes precedence over windowTitle). Obtain from get_windows response (hwnd field). String type to avoid 64-bit precision issues.",
      -        "type": "string"
      -      },
      -      "lensId": {
      -        "description": "Optional perception lens ID. Guards (safe.keyboardTarget) are evaluated before typing, and a perception envelope is attached to post.perception on success.",
      -        "type": "string"
      -      },
      -      "method": {
      -        "default": "auto",
      -        "description": "Input method. background = WM_CHAR PostMessage (no focus change); foreground = SendInput (current default); auto = pick automatically.",
      -        "enum": [
      -          "auto",
      -          "background",
      -          "foreground"
      -        ],
      -        "type": "string"
      -      },
      -      "narrate": {
      -        "default": "minimal",
      -        "description": "Narration level. rich includes UIA or browser state diff when supported.",
      -        "enum": [
      -          "minimal",
      -          "rich"
      -        ],
      -        "type": "string"
      -      },
      -      "replaceAll": {
      -        "default": false,
      -        "description": "When true, send Ctrl+A to select all existing text before typing. Equivalent to Ctrl+A → keyboard(action='type') in one call (requires field already focused). Default false.",
      -        "type": "boolean"
      -      },
      -      "settleMs": {
      -        "default": 300,
      -        "description": "Milliseconds to wait before checking post-action state.",
      -        "maximum": 2000,
      -        "minimum": 0,
      -        "type": "integer"
      -      },
      -      "text": {
      -        "description": "The text to type (max 10,000 characters)",
      -        "maxLength": 10000,
      -        "type": "string"
      -      },
      -      "trackFocus": {
      -        "default": true,
      -        "description": "Detect if focus was stolen after the action.",
      -        "type": "boolean"
      -      },
      -      "use_clipboard": {
      -        "default": false,
      -        "description": "If true, copy text to clipboard and paste with Ctrl+V instead of simulating keystrokes. Use this when typing URLs, paths, or ASCII text into apps with Japanese IME active — prevents IME from converting characters. Default false.",
      -        "type": "boolean"
      -      },
      -      "windowTitle": {
      -        "description": "Partial title of the window that should receive keyboard input.",
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "action",
      -      "text"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "action": {
      -        "const": "press"
      -      },
      -      "forceFocus": {
      -        "description": "Bypass Windows foreground-stealing protection before focusing.",
      -        "type": "boolean"
      -      },
      -      "hwnd": {
      -        "description": "Direct window handle ID (takes precedence over windowTitle). Obtain from get_windows response (hwnd field). String type to avoid 64-bit precision issues.",
      -        "type": "string"
      -      },
      -      "keys": {
      -        "description": "Key combo string, e.g. 'ctrl+c', 'alt+tab', 'enter', 'ctrl+shift+s'. Note: win+r, win+x, win+s, win+l are blocked for security.",
      -        "maxLength": 100,
      -        "type": "string"
      -      },
      -      "lensId": {
      -        "description": "Optional perception lens ID. Guards (safe.keyboardTarget) are evaluated before the key press.",
      -        "type": "string"
      -      },
      -      "method": {
      -        "default": "auto",
      -        "description": "Input method. background = WM_CHAR PostMessage (no focus change); foreground = SendInput (current default); auto = pick automatically.",
      -        "enum": [
      -          "auto",
      -          "background",
      -          "foreground"
      -        ],
      -        "type": "string"
      -      },
      -      "narrate": {
      -        "default": "minimal",
      -        "description": "Narration level. rich includes UIA or browser state diff when supported.",
      -        "enum": [
      -          "minimal",
      -          "rich"
      -        ],
      -        "type": "string"
      -      },
      -      "settleMs": {
      -        "default": 300,
      -        "description": "Milliseconds to wait before checking post-action state.",
      -        "maximum": 2000,
      -        "minimum": 0,
      -        "type": "integer"
      -      },
      -      "trackFocus": {
      -        "default": true,
      -        "description": "Detect if focus was stolen after the action.",
      -        "type": "boolean"
      -      },
      -      "windowTitle": {
      -        "description": "Partial title of the window that should receive keyboard input.",
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "action",
      -      "keys"
      -    ],
      -    "type": "object"
      -  }
      -]New value: +[
      +  {
      +    "additionalProperties": false,
      +    "properties": {
      +      "abortOnFocusLoss": {
      +        "description": "Focus Leash Phase B: when true, the foreground keystroke send is split into chunks (default 8 chars; override via DTM_LEASH_CHUNK_SIZE env) and the target window's foreground state is verified between chunks. If the user grabs focus mid-stream, the call aborts and returns FocusLostDuringType with context.typed (chars delivered to target) and context.remaining (unsent tail) so the caller can re-focus and retry the unsent portion. Default: true when windowTitle is provided, false otherwise. Has no effect on the clipboard path (atomic Ctrl+V) or the BG (WM_CHAR) path (HWND-targeted, foreground-independent).",
      +        "type": "boolean"
      +      },
      +      "action": {
      +        "const": "type"
      +      },
      +      "fixId": {
      +        "description": "Approve a pending suggestedFix (one-shot, 15s TTL). Pass the fixId returned by a previous failed keyboard(action='type') to re-attempt with guard-validated args.",
      +        "type": "string"
      +      },
      +      "forceFocus": {
      +        "description": "Bypass Windows foreground-stealing protection before focusing.",
      +        "type": "boolean"
      +      },
      +      "forceKeystrokes": {
      +        "default": false,
      +        "description": "When true, always use keystroke mode even if text contains non-ASCII symbols (em-dash, en-dash, smart quotes, etc.) that would normally trigger auto-clipboard. Default false — auto-clipboard is enabled.",
      +        "type": "boolean"
      +      },
      +      "hwnd": {
      +        "description": "Direct window handle ID (takes precedence over windowTitle). Obtain from get_windows response (hwnd field). String type to avoid 64-bit precision issues.",
      +        "type": "string"
      +      },
      +      "lensId": {
      +        "description": "Optional perception lens ID. Guards (safe.keyboardTarget) are evaluated before typing, and a perception envelope is attached to post.perception on success.",
      +        "type": "string"
      +      },
      +      "method": {
      +        "default": "auto",
      +        "description": "Input method. background = WM_CHAR PostMessage (no focus change); foreground = SendInput (current default); auto = pick automatically.",
      +        "enum": [
      +          "auto",
      +          "background",
      +          "foreground"
      +        ],
      +        "type": "string"
      +      },
      +      "narrate": {
      +        "default": "minimal",
      +        "description": "Narration level. rich includes UIA or browser state diff when supported.",
      +        "enum": [
      +          "minimal",
      +          "rich"
      +        ],
      +        "type": "string"
      +      },
      +      "replaceAll": {
      +        "default": false,
      +        "description": "When true, send Ctrl+A to select all existing text before typing. Equivalent to Ctrl+A → keyboard(action='type') in one call (requires field already focused). Default false.",
      +        "type": "boolean"
      +      },
      +      "settleMs": {
      +        "default": 300,
      +        "description": "Milliseconds to wait before checking post-action state.",
      +        "maximum": 2000,
      +        "minimum": 0,
      +        "type": "integer"
      +      },
      +      "text": {
      +        "description": "The text to type (max 10,000 characters)",
      +        "maxLength": 10000,
      +        "type": "string"
      +      },
      +      "trackFocus": {
      +        "default": true,
      +        "description": "Detect if focus was stolen after the action.",
      +        "type": "boolean"
      +      },
      +      "use_clipboard": {
      +        "default": false,
      +        "description": "If true, copy text to clipboard and paste with Ctrl+V instead of simulating keystrokes. Use this when typing URLs, paths, or ASCII text into apps with Japanese IME active — prevents IME from converting characters. Default false.",
      +        "type": "boolean"
      +      },
      +      "windowTitle": {
      +        "description": "Partial title of the window that should receive keyboard input.",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "action",
      +      "text"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "additionalProperties": false,
      +    "properties": {
      +      "action": {
      +        "const": "press"
      +      },
      +      "forceFocus": {
      +        "description": "Bypass Windows foreground-stealing protection before focusing.",
      +        "type": "boolean"
      +      },
      +      "hwnd": {
      +        "description": "Direct window handle ID (takes precedence over windowTitle). Obtain from get_windows response (hwnd field). String type to avoid 64-bit precision issues.",
      +        "type": "string"
      +      },
      +      "keys": {
      +        "description": "Key combo string, e.g. 'ctrl+c', 'alt+tab', 'enter', 'ctrl+shift+s'. Note: win+r, win+x, win+s, win+l are blocked for security.",
      +        "maxLength": 100,
      +        "type": "string"
      +      },
      +      "lensId": {
      +        "description": "Optional perception lens ID. Guards (safe.keyboardTarget) are evaluated before the key press.",
      +        "type": "string"
      +      },
      +      "method": {
      +        "default": "auto",
      +        "description": "Input method. background = WM_CHAR PostMessage (no focus change); foreground = SendInput (current default); auto = pick automatically.",
      +        "enum": [
      +          "auto",
      +          "background",
      +          "foreground"
      +        ],
      +        "type": "string"
      +      },
      +      "narrate": {
      +        "default": "minimal",
      +        "description": "Narration level. rich includes UIA or browser state diff when supported.",
      +        "enum": [
      +          "minimal",
      +          "rich"
      +        ],
      +        "type": "string"
      +      },
      +      "settleMs": {
      +        "default": 300,
      +        "description": "Milliseconds to wait before checking post-action state.",
      +        "maximum": 2000,
      +        "minimum": 0,
      +        "type": "integer"
      +      },
      +      "trackFocus": {
      +        "default": true,
      +        "description": "Detect if focus was stolen after the action.",
      +        "type": "boolean"
      +      },
      +      "windowTitle": {
      +        "description": "Partial title of the window that should receive keyboard input.",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "action",
      +      "keys"
      +    ],
      +    "type": "object"
      +  }
      +]
  14. Addedv1.0.3

TDQS

A5/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description fully discloses behavioral nuances: auto-clipboard for non-ASCII, background PostMessage behavior, focus leash chunking, verification contracts, error codes like FocusLostDuringType and BackgroundInputNotDelivered, and platform-specific restrictions. It also details the handling of IME composition and clipboard restoration, leaving no major behavior undocumented.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Although lengthy, the description is well-organized with clear sections (Purpose, Details, Examples) and each sentence carries actionable information. The structure front-loads the core purpose and then systematically covers edge cases, methods, and examples, making it dense but appropriately sized for a complex tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers all aspects needed for correct invocation: parameter behaviors, error codes, verification modes, platform restrictions, and practical examples. Without an output schema, it still explains what results to expect (e.g., hints.verifyDelivery, context.typed/remaining) and how to handle failures, making it complete for an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema already covers all 19 parameters with descriptions, but the tool description adds significant extra meaning: for example, the interplay between use_clipboard and IME, the semantics of forceKeystrokes, abortOnFocusLoss, and forceImeOff, and how steps relate to sequence verification. This goes well beyond the schema's individual parameter descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Send keyboard input to a window' and enumerates three specific actions (type, press, sequence) with examples. It distinguishes itself from sibling tools by explicitly noting alternatives like desktop_act and click_element for different scenarios.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool versus alternatives, such as 'Use desktop_act({action:'setValue'}) for UIA ValuePattern text fields' and 'non-terminal switch to desktop_act / click_element'. It also explains when to use background vs foreground methods and cautions about IME and focus-loss scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Harusame64/desktop-touch-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server