Skip to main content

codetether_agent/tool/computer_use/
schema.rs

1//! JSON Schema advertised by the computer_use tool.
2
3use serde_json::{Value, json};
4
5pub(super) fn parameters_schema() -> Value {
6    json!({
7        "type": "object",
8        "properties": {
9            "action": {
10                "type": "string",
11                "enum": [
12                    "status", "list_apps", "request_app",
13                    "snapshot", "window_snapshot",
14                    "click", "right_click", "double_click", "drag",
15                    "type_text", "press_key", "scroll",
16                    "bring_to_front", "wait_ms", "stop"
17                ],
18                "description": "Action to execute. Snapshot saves JPEG to temp. Use bring_to_front before interacting."
19            },
20            "app": {"type": "string", "description": "App name for request_app."},
21            "hwnd": {"type": "integer", "description": "Window handle from list_apps."},
22            "text": {"type": "string", "description": "Text for type_text."},
23            "key": {"type": "string", "description": "SendKeys for press_key: ^c, %{TAB}, ENTER."},
24            "scroll_amount": {"type": "integer", "description": "Wheel delta; negative=down."},
25            "x": {"type": "number", "description": "X coord for click/drag start."},
26            "y": {"type": "number", "description": "Y coord for click/drag start."},
27            "x2": {"type": "number", "description": "End X for drag."},
28            "y2": {"type": "number", "description": "End Y for drag."},
29            "ms": {"type": "integer", "description": "Ms to wait for wait_ms."}
30        },
31        "required": ["action"],
32        "examples": [
33            {"action": "snapshot"}, {"action": "list_apps"},
34            {"action": "bring_to_front", "hwnd": 123456},
35            {"action": "click", "x": 100, "y": 200},
36            {"action": "right_click", "x": 300, "y": 400},
37            {"action": "double_click", "x": 500, "y": 300},
38            {"action": "drag", "x": 100, "y": 200, "x2": 400, "y2": 500},
39            {"action": "press_key", "key": "^c"},
40            {"action": "type_text", "text": "hello world"},
41            {"action": "wait_ms", "ms": 500}
42        ]
43    })
44}