feat: 浏览器一期:坐标点击 + live 截图
- browser_click_at(x, y):视口坐标点击(1280x800、左上角 原点),越界与非数字拒绝;live 视图里用户在截图上的 点击落点就走这个工具。 - browser_live_shot:固定文件 browser-live.png + 状态 sidecar browser-live.json(URL/标题/时间戳),watcher 轮询一个稳定路径即可;技能要求每次动作后都调一次, 保持画面最新。 - MCP 新增 browser_click_at / browser_live_shot 两个工具; 技能补 live 视图一节;测试 9 项(含 fake mouse、越界、 live 文件与状态读回)。
This commit is contained in:
1 parent
cb6de0e3aa
commit
814fe8f7c2
4 files changed
+151
-1
No files matched your search
@@ -109,6 +109,44 @@ _TOOLS = [
|
||||
"required": ["expression"],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "browser_click_at",
|
||||
"description": (
|
||||
"Click at viewport coordinates (CSS pixels, origin "
|
||||
"top-left of the 1280x800 viewport). This is the tool "
|
||||
"a live viewer drives: the user clicks on a screenshot "
|
||||
"and the coordinates arrive here. Then snapshot to see "
|
||||
"the result."
|
||||
),
|
||||
"inputSchema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"x": {"type": "number"},
|
||||
"y": {"type": "number"},
|
||||
},
|
||||
"required": ["x", "y"],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "browser_live_shot",
|
||||
"description": (
|
||||
"Screenshot to the FIXED live-view file "
|
||||
"browser-live.png plus a browser-live.json status "
|
||||
"sidecar (url, title, timestamp), so a watcher can "
|
||||
"poll one stable path. Call after every navigate / "
|
||||
"click / fill while a live view is wanted. Returns "
|
||||
"path, bytes, url, title and timestamp."
|
||||
),
|
||||
"inputSchema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"output_filename": {"type": "string",
|
||||
"description": "Plain basename "
|
||||
"to save as. Default: "
|
||||
"browser-live.png"},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "browser_screenshot",
|
||||
"description": (
|
||||
@@ -199,6 +237,11 @@ def handle_request(request, browser=None):
|
||||
elif name == "browser_fill":
|
||||
result = target.fill(args.get("selector"),
|
||||
args.get("text"))
|
||||
elif name == "browser_click_at":
|
||||
result = target.click_at(args.get("x"), args.get("y"))
|
||||
elif name == "browser_live_shot":
|
||||
result = target.live_shot(
|
||||
args.get("output_filename"))
|
||||
elif name == "browser_evaluate":
|
||||
result = target.evaluate(args.get("expression"))
|
||||
elif name == "browser_screenshot":
|
||||
|
||||
Reference in new issue
Block a user