Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fix(cua-driver): stop advertising pid as required for element_token tools (#5047)

Johnnya85f1be9cb78
diff --git a/docs/content/docs/cua-driver/reference/mcp-tools/double-and-right-click.mdx b/docs/content/docs/cua-driver/reference/mcp-tools/double-and-right-click.mdx
index e1c13d974f..2334069a84 100644
--- a/docs/content/docs/cua-driver/reference/mcp-tools/double-and-right-click.mdx
+++ b/docs/content/docs/cua-driver/reference/mcp-tools/double-and-right-click.mdx
@@ -67,7 +67,7 @@ Double-click against a target pid. Two addressing modes:
- `x`, `y` (window-local screenshot pixels, top-left origin of the PNG returned by `get_window_state`): posts two WM_LBUTTONDOWN/UP pairs in quick succession to the deepest child window at that point.
-Exactly one of `element_token` or (`x` AND `y`) must be provided. `pid` is required in both modes. The macOS-only `modifier` field is accepted for parity (no-op on Windows: PostMessage doesn't propagate modifier-key state).
+Exactly one of `element_token` or (`x` AND `y`) must be provided. `pid` is required with `x`, `y`; an `element_token` carries its own pid. The macOS-only `modifier` field is accepted for parity (no-op on Windows: PostMessage doesn't propagate modifier-key state).
**Windows parameters**
@@ -88,15 +88,9 @@ Exactly one of `element_token` or (`x` AND `y`) must be provided. `pid` is requi
| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| <span id="double_click--element_token"></span>`element_token` | `string` | | Element handle `<snapshot_id>:<row>` from get_window_state: row `[11]` of a read whose snapshot_id is s0000002a is "s0000002a:11" (also in `structuredContent.elements[].element_token`). Returns an explicit stale error naming the current snapshots once a newer read supersedes it. |
-| <span id="double_click--pid"></span>`pid` | `integer` | required | Target process ID. |
+| <span id="double_click--pid"></span>`pid` | `integer` | | Target process ID. Optional with element_token (the token carries the pid). |
| <span id="double_click--session"></span>`session` | `string` | | For multi-call work, prefer a short public session label and repeat it on every call that accepts it. Omit it to use the authenticated transport's implicit lifecycle session. |
-**Example arguments**
-
-```json
-{"pid":1}
-```
-
## `right_click`
Effect: destructive. Platforms: macOS, Linux, Windows.
@@ -110,7 +104,7 @@ Right-click against a target pid. Two addressing modes:
- `x`, `y`: synthesizes `rightMouseDown` / `rightMouseUp` CGEvent pair posted to the pid. Driver converts image-pixel → screen-point internally. `modifier` forces the CGEvent path (AX actions don't propagate modifier keys).
-Exactly one of `element_token` or (`x` AND `y`) must be provided. `pid` always required.
+Exactly one of `element_token` or (`x` AND `y`) must be provided. `pid` is required with `x`, `y`; an `element_token` carries its own pid.
**macOS parameters**
@@ -149,7 +143,7 @@ Right-click against a target pid. Two addressing modes:
- `x`, `y` (window-local screenshot pixels, top-left origin of the PNG returned by `get_window_state`): posts WM_RBUTTONDOWN/UP to the deepest child window at that point.
-Exactly one of `element_token` or (`x` AND `y`) must be provided. `pid` is required in both modes. `modifier` is accepted for parity (no-op on Windows: PostMessage doesn't propagate modifier-key state).
+Exactly one of `element_token` or (`x` AND `y`) must be provided. `pid` is required with `x`, `y`; an `element_token` carries its own pid. `modifier` is accepted for parity (no-op on Windows: PostMessage doesn't propagate modifier-key state).
**Windows parameters**
@@ -170,11 +164,5 @@ Exactly one of `element_token` or (`x` AND `y`) must be provided. `pid` is requi
| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| <span id="right_click--element_token"></span>`element_token` | `string` | | Element handle `<snapshot_id>:<row>` from get_window_state: row `[11]` of a read whose snapshot_id is s0000002a is "s0000002a:11" (also in `structuredContent.elements[].element_token`). Returns an explicit stale error naming the current snapshots once a newer read supersedes it. |
-| <span id="right_click--pid"></span>`pid` | `integer` | required | Target process ID. |
+| <span id="right_click--pid"></span>`pid` | `integer` | | Target process ID. Optional with element_token (the token carries the pid). |
| <span id="right_click--session"></span>`session` | `string` | | For multi-call work, prefer a short public session label and repeat it on every call that accepts it. Omit it to use the authenticated transport's implicit lifecycle session. |
-
-**Example arguments**
-
-```json
-{"pid":1}
-```
diff --git a/docs/content/docs/cua-driver/reference/mcp-tools/keys-and-shortcuts.mdx b/docs/content/docs/cua-driver/reference/mcp-tools/keys-and-shortcuts.mdx
index cca17e4a75..08f3591012 100644
--- a/docs/content/docs/cua-driver/reference/mcp-tools/keys-and-shortcuts.mdx
+++ b/docs/content/docs/cua-driver/reference/mcp-tools/keys-and-shortcuts.mdx
@@ -132,7 +132,7 @@ Recognized modifiers: cmd/command, shift, option/alt, ctrl/control, fn. Non-modi
| --- | --- | --- | --- |
| <span id="hotkey--macos--delivery_mode"></span>`delivery_mode` | `"background" \| "foreground"` | | Best-effort-background ladder rung (default "background"). "background": inject without fronting or raising the target; no focus steal. "foreground": briefly front the target, act, then restore the prior frontmost; the explicit last resort when a background attempt didn't land. Re-call with "foreground" only for the action that needs it. |
| <span id="hotkey--macos--keys"></span>`keys` | `string[]` | required | Modifier(s) and one non-modifier key, e.g. ["cmd", "c"]. Items: 2 to any. |
-| <span id="hotkey--macos--pid"></span>`pid` | `integer` | | Target process ID. |
+| <span id="hotkey--macos--pid"></span>`pid` | `integer` | | Target process ID. Required with x, y; optional with element_token (the token carries the pid). |
| <span id="hotkey--macos--scope"></span>`scope` | `"window" \| "desktop"` | `"window"` | Use desktop with no pid/window_id to send the chord to the frontmost application. |
| <span id="hotkey--macos--window_id"></span>`window_id` | `integer` | | Target window. Required for delivery_mode:"foreground" (the NSMenu activation needs a window). Does NOT itself raise the window: raising is gated on delivery_mode. |
| <span id="hotkey--macos--x"></span>`x` | `number` | | Screenshot-pixel X: the element px action form: pixel-click there to focus, then send the combo (so e.g. Cmd+V pastes into that field). Pass with y. Use for Chromium/Electron surfaces the background combo can't reach. |
diff --git a/docs/content/docs/cua-driver/reference/mcp-tools/values-and-clipboard.mdx b/docs/content/docs/cua-driver/reference/mcp-tools/values-and-clipboard.mdx
index c9f84cb3c2..5afa2e9ad8 100644
--- a/docs/content/docs/cua-driver/reference/mcp-tools/values-and-clipboard.mdx
+++ b/docs/content/docs/cua-driver/reference/mcp-tools/values-and-clipboard.mdx
@@ -81,12 +81,12 @@ For free-form text entry that the target accepts via keystrokes only, prefer `ty
| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| <span id="set_value--element_token"></span>`element_token` | `string` | | Element handle `<snapshot_id>:<row>` from get_window_state: row `[11]` of a read whose snapshot_id is s0000002a is "s0000002a:11" (also in `structuredContent.elements[].element_token`). Returns an explicit stale error naming the current snapshots once a newer read supersedes it. |
-| <span id="set_value--pid"></span>`pid` | `integer` | required | Target process ID. |
+| <span id="set_value--pid"></span>`pid` | `integer` | | Target process ID. Optional with element_token (the token carries the pid). |
**Example arguments**
```json
-{"pid":1,"value":"<value>"}
+{"value":"<value>"}
```
## `clipboard_read`
diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/tool_schema.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/tool_schema.rs
index b3cd09a75d..e60d3e26c7 100644
--- a/libs/cua-driver/rust/crates/cua-driver-core/src/tool_schema.rs
+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/tool_schema.rs
@@ -200,10 +200,12 @@ fn required_canonical(tool: &str) -> Option<&'static [&'static str]> {
// `pid` is conditionally required (validated in code: needed unless a
// windowless desktop-scope call), so it is intentionally NOT pinned here.
"click" => &[],
+ // An element_token carries its own pid, so element-addressed tools
+ // never require `pid` in the schema (validated in code for x/y).
+ "double_click" | "right_click" => &[],
+ "set_value" => &["value"],
"scroll" => &["direction"],
"zoom" => &["window_id", "x1", "y1", "x2", "y2"],
- // double_click / right_click are already consistent across platforms —
- // not pinned, so we don't force a behavior change on them.
_ => return None,
})
}
@@ -420,6 +422,24 @@ mod tests {
let tool = json!({ "type": "object", "required": [], "properties": {} });
assert!(shared_schema_violations("click", &tool).is_empty());
}
+
+ #[test]
+ fn element_token_tools_must_not_require_pid() {
+ for (tool_name, required) in [
+ ("double_click", json!(["pid"])),
+ ("right_click", json!(["pid"])),
+ ("set_value", json!(["pid", "value"])),
+ ] {
+ let tool = json!({ "type": "object", "required": required, "properties": {} });
+ let v = shared_schema_violations(tool_name, &tool);
+ assert!(
+ v.iter().any(|s| s.contains("required")),
+ "{tool_name}: {v:?}"
+ );
+ }
+ let set_value = json!({ "type": "object", "required": ["value"], "properties": {} });
+ assert!(shared_schema_violations("set_value", &set_value).is_empty());
+ }
#[test]
fn element_token_pattern_matches_the_minted_wire_shape() {
let schema = element_token_schema();
diff --git a/libs/cua-driver/rust/crates/platform-linux/src/tools/impl_.rs b/libs/cua-driver/rust/crates/platform-linux/src/tools/impl_.rs
index 3c07cd7bee..98fe985d5b 100644
--- a/libs/cua-driver/rust/crates/platform-linux/src/tools/impl_.rs
+++ b/libs/cua-driver/rust/crates/platform-linux/src/tools/impl_.rs
@@ -9172,9 +9172,9 @@ impl Tool for SetValueTool {
name: "set_value".into(),
description: "Set value of an AT-SPI element via SetValue action.".into(),
input_schema: json!({
- "type":"object","required":["pid","value"],"properties":{
+ "type":"object","required":["value"],"properties":{
"session": cua_driver_core::tool_schema::session_schema(),
- "pid":{"type":"integer","description":"Target process ID."},
+ "pid":{"type":"integer","description":"Target process ID. Optional with element_token (the token carries the pid)."},
"window_id":{"type":"integer","description":"Omit when element_token is supplied (the token carries it)."},
"element_token": cua_driver_core::tool_schema::element_token_schema(),
"value":{"type":"string","description":"New value. Written through AT-SPI EditableText/Value when the element exposes them; otherwise (GTK2 spin scales, VCL spin buttons) the field is clicked with the session's real pointer, its text selected and replaced through the virtual keyboard and committed with Tab, then read back."},
@@ -10186,10 +10186,10 @@ impl Tool for DoubleClickTool {
(target_occluded), one covered by this app's own dialog is retargeted to it \
(retargeted_to). No focus steal. Provide either (window_id + x/y) or (pid + element_token). \
After a zoom call, pass from_zoom=true to auto-translate zoom-image coords.".into(),
- input_schema: json!({"type":"object","required":["pid"],"properties":{
+ input_schema: json!({"type":"object","required":[],"properties":{
"session": cua_driver_core::tool_schema::session_schema(),
"cursor_id":{"type":"string","description":"Optional multi-cursor instance id. Default: 'default'."},
- "pid":{"type":"integer","description":"Target process ID."},
+ "pid":{"type":"integer","description":"Target process ID. Optional with element_token (the token carries the pid)."},
"window_id":{"type":"integer","description":"Window id from list_windows. Required with x/y or element_index; optional with element_token (the token carries it)."},
"x":{"type":"number","description":"Window-local pixel X of the target window's own get_window_state screenshot (0..screenshot_width). For get_desktop_state pixels pass scope:\"desktop\" (or coordinate_frame:\"desktop\")."},
"y":{"type":"number","description":"Window-local pixel Y of the target window's own get_window_state screenshot (0..screenshot_height); see x."},
@@ -10472,10 +10472,10 @@ impl Tool for RightClickTool {
title}`): call get_window_state(pid, window_id=<that id>) to index its menu items \
and click them by element_token. Provide either (window_id + x/y) or (pid + element_token). \
After a zoom call, pass from_zoom=true to auto-translate zoom-image coords.".into(),
- input_schema: json!({"type":"object","required":["pid"],"properties":{
+ input_schema: json!({"type":"object","required":[],"properties":{
"session": cua_driver_core::tool_schema::session_schema(),
"cursor_id":{"type":"string","description":"Optional multi-cursor instance id. Default: 'default'."},
- "pid":{"type":"integer","description":"Target process ID."},
+ "pid":{"type":"integer","description":"Target process ID. Optional with element_token (the token carries the pid)."},
"window_id":{"type":"integer","description":"Window id from list_windows. Required with x/y or element_index; optional with element_token (the token carries it)."},
"x":{"type":"number","description":"Window-local pixel X of the target window's own get_window_state screenshot (0..screenshot_width). For get_desktop_state pixels pass scope:\"desktop\" (or coordinate_frame:\"desktop\")."},
"y":{"type":"number","description":"Window-local pixel Y of the target window's own get_window_state screenshot (0..screenshot_height); see x."},
diff --git a/libs/cua-driver/rust/crates/platform-macos/src/tools/double_click.rs b/libs/cua-driver/rust/crates/platform-macos/src/tools/double_click.rs
index fd8d3273b9..0fafc8359d 100644
--- a/libs/cua-driver/rust/crates/platform-macos/src/tools/double_click.rs
+++ b/libs/cua-driver/rust/crates/platform-macos/src/tools/double_click.rs
@@ -46,10 +46,10 @@ fn def() -> &'static ToolDef {
.into(),
input_schema: serde_json::json!({
"type": "object",
- "required": ["pid"],
+ "required": [],
"properties": {
"session": { "type": "string", "description": "For multi-call work, prefer a short public session label and repeat it on every call that accepts it. Omit it to use the authenticated transport's implicit lifecycle session." },
- "pid": { "type": "integer", "description": "Target process ID." },
+ "pid": { "type": "integer", "description": "Target process ID. Optional with element_token (the token carries the pid)." },
"x": { "type": "number", "description": "Screen X coordinate (pixel path)." },
"y": { "type": "number", "description": "Screen Y coordinate (pixel path)." },
"window_id": { "type": "integer", "description": "CGWindowID. Omit when element_token is supplied (the token carries it)." },
diff --git a/libs/cua-driver/rust/crates/platform-macos/src/tools/hotkey.rs b/libs/cua-driver/rust/crates/platform-macos/src/tools/hotkey.rs
index 87aed0fd84..3b44e65bcd 100644
--- a/libs/cua-driver/rust/crates/platform-macos/src/tools/hotkey.rs
+++ b/libs/cua-driver/rust/crates/platform-macos/src/tools/hotkey.rs
@@ -63,7 +63,7 @@ fn def() -> &'static ToolDef {
"required": ["keys"],
"properties": {
"session": { "type": "string", "description": "For multi-call work, prefer a short public session label and repeat it on every call that accepts it. Omit it to use the authenticated transport's implicit lifecycle session." },
- "pid": { "type": "integer", "description": "Target process ID." },
+ "pid": { "type": "integer", "description": "Target process ID. Required with x, y; optional with element_token (the token carries the pid)." },
"keys": {
"type": "array",
"items": { "type": "string" },
@@ -200,7 +200,7 @@ impl Tool for HotkeyTool {
};
}
- let pid = match args.require_i32("pid") {
+ let pid = match super::target_pid(&self.state, &args) {
Ok(v) => v,
Err(e) => return e,
};
@@ -534,6 +534,20 @@ mod tests {
}
}
+ #[tokio::test]
+ async fn a_token_only_hotkey_takes_its_pid_from_the_token() {
+ let tool = HotkeyTool::new(Arc::new(ToolState::new(false, false, None)));
+ let result = tool
+ .invoke(serde_json::json!({
+ "keys": ["cmd", "c"],
+ "element_token": "s7fffffff:0",
+ }))
+ .await;
+ assert_eq!(result.is_error, Some(true));
+ let structured = result.structured_content.expect("structured refusal");
+ assert_eq!(structured["refusal"]["code"], "stale_element_token");
+ }
+
#[test]
fn hotkey_contract_accepts_snapshot_bound_ax_targets() {
let properties = def().input_schema["properties"]
diff --git a/libs/cua-driver/rust/crates/platform-macos/src/tools/right_click.rs b/libs/cua-driver/rust/crates/platform-macos/src/tools/right_click.rs
index 9f492f8d8c..a16dc71830 100644
--- a/libs/cua-driver/rust/crates/platform-macos/src/tools/right_click.rs
+++ b/libs/cua-driver/rust/crates/platform-macos/src/tools/right_click.rs
@@ -36,15 +36,15 @@ fn def() -> &'static ToolDef {
- `x`, `y` — synthesizes `rightMouseDown` / `rightMouseUp` CGEvent pair posted \
to the pid. Driver converts image-pixel → screen-point internally. \
`modifier` forces the CGEvent path (AX actions don't propagate modifier keys).\n\n\
- Exactly one of `element_token` or (`x` AND `y`) must be provided. `pid` always \
- required."
+ Exactly one of `element_token` or (`x` AND `y`) must be provided. `pid` is \
+ required with `x`, `y`; an `element_token` carries its own pid."
.into(),
input_schema: serde_json::json!({
"type": "object",
- "required": ["pid"],
+ "required": [],
"properties": {
"session": { "type": "string", "description": "For multi-call work, prefer a short public session label and repeat it on every call that accepts it. Omit it to use the authenticated transport's implicit lifecycle session." },
- "pid": { "type": "integer", "description": "Target process ID." },
+ "pid": { "type": "integer", "description": "Target process ID. Optional with element_token (the token carries the pid)." },
"element_token": cua_driver_core::tool_schema::element_token_schema(),
"window_id": {
"type": "integer",
diff --git a/libs/cua-driver/rust/crates/platform-macos/src/tools/set_value.rs b/libs/cua-driver/rust/crates/platform-macos/src/tools/set_value.rs
index 03e10e7eb2..26f6785580 100644
--- a/libs/cua-driver/rust/crates/platform-macos/src/tools/set_value.rs
+++ b/libs/cua-driver/rust/crates/platform-macos/src/tools/set_value.rs
@@ -51,10 +51,10 @@ fn def() -> &'static ToolDef {
A Finder file name (list row or Get Info `Name` field, not being edited) is refused with `file_name_needs_rename`; the refusal names the keyboard route. For free-form text in web inputs use `type_text_chars`: WebKit ignores AXValue writes.".into(),
input_schema: serde_json::json!({
"type": "object",
- "required": ["pid", "value"],
+ "required": ["value"],
"properties": {
"session": { "type": "string", "description": "For multi-call work, prefer a short public session label and repeat it on every call that accepts it." },
- "pid": { "type": "integer", "description": "Target process ID." },
+ "pid": { "type": "integer", "description": "Target process ID. Optional with element_token (the token carries the pid)." },
"window_id": {
"type": "integer",
"description": "Window ID. Omit with element_token."
diff --git a/libs/cua-driver/rust/crates/platform-windows/src/tools/impl_.rs b/libs/cua-driver/rust/crates/platform-windows/src/tools/impl_.rs
index e9793e6acf..9c0c95823b 100644
--- a/libs/cua-driver/rust/crates/platform-windows/src/tools/impl_.rs
+++ b/libs/cua-driver/rust/crates/platform-windows/src/tools/impl_.rs
@@ -6030,9 +6030,9 @@ impl Tool for SetValueTool {
`type_text` — UIA ValuePattern writes are ignored by some web inputs (same \
caveat as Swift's `AXValue`-vs-WebKit).".into(),
input_schema: json!({
- "type":"object","required":["pid","value"],"properties":{
+ "type":"object","required":["value"],"properties":{
"session": cua_driver_core::tool_schema::session_schema(),
- "pid":{"type":"integer","description":"Target process ID."},
+ "pid":{"type":"integer","description":"Target process ID. Optional with element_token (the token carries the pid)."},
"window_id":{"type":"integer","description":"HWND of the window. Omit when element_token is supplied (the token carries it)."},
"element_token": cua_driver_core::tool_schema::element_token_schema(),
"value":{"type":"string","description":"New value. UIA will coerce to the element's native type."},
@@ -6896,11 +6896,11 @@ impl Tool for DoubleClickTool {
returned by `get_window_state`) — posts two WM_LBUTTONDOWN/UP pairs in \
quick succession to the deepest child window at that point.\n\n\
Exactly one of `element_token` or (`x` AND `y`) must be provided. \
- `pid` is required in both modes. The macOS-only `modifier` field is accepted for \
+ `pid` is required with `x`, `y`; an `element_token` carries its own pid. The macOS-only `modifier` field is accepted for \
parity (no-op on Windows — PostMessage doesn't propagate modifier-key state).".into(),
- input_schema: json!({"type":"object","required":["pid"],"properties":{
+ input_schema: json!({"type":"object","required":[],"properties":{
"session": cua_driver_core::tool_schema::session_schema(),
- "pid":{"type":"integer","description":"Target process ID."},
+ "pid":{"type":"integer","description":"Target process ID. Optional with element_token (the token carries the pid)."},
"window_id":{"type":"integer","description":"HWND for the target window. Omit when element_token is supplied (the token carries it)."},
"element_token": cua_driver_core::tool_schema::element_token_schema(),
"x":{"type":"number","description":"X in window-local screenshot pixels. Must be provided together with y."},
@@ -7262,12 +7262,12 @@ impl Tool for RightClickTool {
returned by `get_window_state`) — posts WM_RBUTTONDOWN/UP to the deepest \
child window at that point.\n\n\
Exactly one of `element_token` or (`x` AND `y`) must be provided. `pid` is \
- required in both modes. \
+ required with `x`, `y`; an `element_token` carries its own pid. \
`modifier` is accepted for parity (no-op on Windows — PostMessage doesn't \
propagate modifier-key state).".into(),
- input_schema: json!({"type":"object","required":["pid"],"properties":{
+ input_schema: json!({"type":"object","required":[],"properties":{
"session": cua_driver_core::tool_schema::session_schema(),
- "pid":{"type":"integer","description":"Target process ID."},
+ "pid":{"type":"integer","description":"Target process ID. Optional with element_token (the token carries the pid)."},
"window_id":{"type":"integer","description":"HWND for the target window. Omit when element_token is supplied (the token carries it)."},
"element_token": cua_driver_core::tool_schema::element_token_schema(),
"x":{"type":"number","description":"X in window-local screenshot pixels. Must be provided together with y."},
diff --git a/scripts/docs-generators/cli-specs/cua-driver-mcp-linux.json b/scripts/docs-generators/cli-specs/cua-driver-mcp-linux.json
index 0b9450e8b4..34f9c6aced 100644
--- a/scripts/docs-generators/cli-specs/cua-driver-mcp-linux.json
+++ b/scripts/docs-generators/cli-specs/cua-driver-mcp-linux.json
@@ -648,7 +648,7 @@
"type": "boolean"
},
"pid": {
- "description": "Target process ID.",
+ "description": "Target process ID. Optional with element_token (the token carries the pid).",
"type": "integer"
},
"session": {
@@ -668,9 +668,7 @@
"type": "number"
}
},
- "required": [
- "pid"
- ],
+ "required": [],
"type": "object"
},
"name": "double_click",
@@ -721,7 +719,7 @@
"type": "array"
},
"pid": {
- "description": "Target process ID.",
+ "description": "Target process ID. Optional with element_token (the token carries the pid).",
"type": "integer"
},
"session": {
@@ -741,9 +739,7 @@
"type": "number"
}
},
- "required": [
- "pid"
- ],
+ "required": [],
"type": "object"
},
"name": "right_click",
@@ -1502,7 +1498,7 @@
"type": "string"
},
"pid": {
- "description": "Target process ID.",
+ "description": "Target process ID. Optional with element_token (the token carries the pid).",
"type": "integer"
},
"session": {
@@ -1519,7 +1515,6 @@
}
},
"required": [
- "pid",
"value"
],
"type": "object"
diff --git a/scripts/docs-generators/cli-specs/cua-driver-mcp-macos.json b/scripts/docs-generators/cli-specs/cua-driver-mcp-macos.json
index a4e68a4247..049a78bd0c 100644
--- a/scripts/docs-generators/cli-specs/cua-driver-mcp-macos.json
+++ b/scripts/docs-generators/cli-specs/cua-driver-mcp-macos.json
@@ -629,7 +629,7 @@
"type": "string"
},
"pid": {
- "description": "Target process ID.",
+ "description": "Target process ID. Optional with element_token (the token carries the pid).",
"type": "integer"
},
"session": {
@@ -649,16 +649,14 @@
"type": "number"
}
},
- "required": [
- "pid"
- ],
+ "required": [],
"type": "object"
},
"name": "double_click",
"read_only": false
},
{
- "description": "Right-click against a target pid. Two addressing modes:\n\n- `element_token` (from the last `get_window_state` snapshot) — performs `AXShowMenu` on the cached element. Pure AX RPC, works on backgrounded / hidden windows, no cursor move or focus steal. Requires a prior `get_window_state(pid, window_id)` in this turn.\n\n- `x`, `y` — synthesizes `rightMouseDown` / `rightMouseUp` CGEvent pair posted to the pid. Driver converts image-pixel → screen-point internally. `modifier` forces the CGEvent path (AX actions don't propagate modifier keys).\n\nExactly one of `element_token` or (`x` AND `y`) must be provided. `pid` always required.",
+ "description": "Right-click against a target pid. Two addressing modes:\n\n- `element_token` (from the last `get_window_state` snapshot) — performs `AXShowMenu` on the cached element. Pure AX RPC, works on backgrounded / hidden windows, no cursor move or focus steal. Requires a prior `get_window_state(pid, window_id)` in this turn.\n\n- `x`, `y` — synthesizes `rightMouseDown` / `rightMouseUp` CGEvent pair posted to the pid. Driver converts image-pixel → screen-point internally. `modifier` forces the CGEvent path (AX actions don't propagate modifier keys).\n\nExactly one of `element_token` or (`x` AND `y`) must be provided. `pid` is required with `x`, `y`; an `element_token` carries its own pid.",
"destructive": true,
"idempotent": false,
"input_schema": {
@@ -685,7 +683,7 @@
"type": "array"
},
"pid": {
- "description": "Target process ID.",
+ "description": "Target process ID. Optional with element_token (the token carries the pid).",
"type": "integer"
},
"session": {
@@ -705,9 +703,7 @@
"type": "number"
}
},
- "required": [
- "pid"
- ],
+ "required": [],
"type": "object"
},
"name": "right_click",
@@ -1071,7 +1067,7 @@
"type": "array"
},
"pid": {
- "description": "Target process ID.",
+ "description": "Target process ID. Required with x, y; optional with element_token (the token carries the pid).",
"type": "integer"
},
"scope": {
@@ -1153,7 +1149,7 @@
"type": "string"
},
"pid": {
- "description": "Target process ID.",
+ "description": "Target process ID. Optional with element_token (the token carries the pid).",
"type": "integer"
},
"session": {
@@ -1170,7 +1166,6 @@
}
},
"required": [
- "pid",
"value"
],
"type": "object"
diff --git a/scripts/docs-generators/cli-specs/cua-driver-mcp-windows.json b/scripts/docs-generators/cli-specs/cua-driver-mcp-windows.json
index c33dad592e..1bc8858b8b 100644
--- a/scripts/docs-generators/cli-specs/cua-driver-mcp-windows.json
+++ b/scripts/docs-generators/cli-specs/cua-driver-mcp-windows.json
@@ -648,7 +648,7 @@
"read_only": false
},
{
- "description": "Double-click against a target pid. Two addressing modes:\n\n- `element_token` (from the last `get_window_state` snapshot of that window) — synthesizes a stamped pixel double-click at the element's cached on-screen center via PostMessage. (Windows has no AXOpen analogue; Swift's AXOpen-first path falls through to the same pixel recipe when the element doesn't advertise AXOpen, so the user-visible behavior matches.)\n\n- `x`, `y` (window-local screenshot pixels, top-left origin of the PNG returned by `get_window_state`) — posts two WM_LBUTTONDOWN/UP pairs in quick succession to the deepest child window at that point.\n\nExactly one of `element_token` or (`x` AND `y`) must be provided. `pid` is required in both modes. The macOS-only `modifier` field is accepted for parity (no-op on Windows — PostMessage doesn't propagate modifier-key state).",
+ "description": "Double-click against a target pid. Two addressing modes:\n\n- `element_token` (from the last `get_window_state` snapshot of that window) — synthesizes a stamped pixel double-click at the element's cached on-screen center via PostMessage. (Windows has no AXOpen analogue; Swift's AXOpen-first path falls through to the same pixel recipe when the element doesn't advertise AXOpen, so the user-visible behavior matches.)\n\n- `x`, `y` (window-local screenshot pixels, top-left origin of the PNG returned by `get_window_state`) — posts two WM_LBUTTONDOWN/UP pairs in quick succession to the deepest child window at that point.\n\nExactly one of `element_token` or (`x` AND `y`) must be provided. `pid` is required with `x`, `y`; an `element_token` carries its own pid. The macOS-only `modifier` field is accepted for parity (no-op on Windows — PostMessage doesn't propagate modifier-key state).",
"destructive": true,
"idempotent": false,
"input_schema": {
@@ -679,7 +679,7 @@
"type": "array"
},
"pid": {
- "description": "Target process ID.",
+ "description": "Target process ID. Optional with element_token (the token carries the pid).",
"type": "integer"
},
"session": {
@@ -699,16 +699,14 @@
"type": "number"
}
},
- "required": [
- "pid"
- ],
+ "required": [],
"type": "object"
},
"name": "double_click",
"read_only": false
},
{
- "description": "Right-click against a target pid. Two addressing modes:\n\n- `element_token` (from the last `get_window_state` snapshot of that window) — posts WM_RBUTTONDOWN/UP at the element's cached on-screen center via PostMessage. (Windows has no AXShowMenu analogue wired up yet; Swift's AX-action path falls through to the same pixel recipe on non-advertising elements, so user-visible behavior matches.)\n\n- `x`, `y` (window-local screenshot pixels, top-left origin of the PNG returned by `get_window_state`) — posts WM_RBUTTONDOWN/UP to the deepest child window at that point.\n\nExactly one of `element_token` or (`x` AND `y`) must be provided. `pid` is required in both modes. `modifier` is accepted for parity (no-op on Windows — PostMessage doesn't propagate modifier-key state).",
+ "description": "Right-click against a target pid. Two addressing modes:\n\n- `element_token` (from the last `get_window_state` snapshot of that window) — posts WM_RBUTTONDOWN/UP at the element's cached on-screen center via PostMessage. (Windows has no AXShowMenu analogue wired up yet; Swift's AX-action path falls through to the same pixel recipe on non-advertising elements, so user-visible behavior matches.)\n\n- `x`, `y` (window-local screenshot pixels, top-left origin of the PNG returned by `get_window_state`) — posts WM_RBUTTONDOWN/UP to the deepest child window at that point.\n\nExactly one of `element_token` or (`x` AND `y`) must be provided. `pid` is required with `x`, `y`; an `element_token` carries its own pid. `modifier` is accepted for parity (no-op on Windows — PostMessage doesn't propagate modifier-key state).",
"destructive": true,
"idempotent": false,
"input_schema": {
@@ -739,7 +737,7 @@
"type": "array"
},
"pid": {
- "description": "Target process ID.",
+ "description": "Target process ID. Optional with element_token (the token carries the pid).",
"type": "integer"
},
"session": {
@@ -759,9 +757,7 @@
"type": "number"
}
},
- "required": [
- "pid"
- ],
+ "required": [],
"type": "object"
},
"name": "right_click",
@@ -1211,7 +1207,7 @@
"type": "string"
},
"pid": {
- "description": "Target process ID.",
+ "description": "Target process ID. Optional with element_token (the token carries the pid).",
"type": "integer"
},
"session": {
@@ -1228,7 +1224,6 @@
}
},
"required": [
- "pid",
"value"
],
"type": "object"