Open new window
This commit is contained in:
1 parent
52ddc6ba9a
commit
2873da3c84
3 files changed
+38
No files matched your search
@@ -29,6 +29,7 @@ from .list_tabs import handle as list_tabs_handler
|
||||
from .switch_tab import handle as switch_tab_handler
|
||||
from .navigate_to import handle as navigate_to_handler
|
||||
from .open_new_tab import handle as open_new_tab_handler
|
||||
from .open_new_window import handle as open_new_window_handler
|
||||
from .get_current_url import handle as get_current_url_handler
|
||||
from .get_page_cookies import handle as get_page_cookies_handler
|
||||
|
||||
@@ -233,4 +234,16 @@ TOOL_REGISTRY = [
|
||||
},
|
||||
handler=get_page_cookies_handler
|
||||
),
|
||||
Tool(
|
||||
name="open_new_window",
|
||||
description="Opens a new Firefox window with the specified URL.",
|
||||
schema={
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"url": {"type": "string", "description": "The URL to open in the new window"}
|
||||
},
|
||||
"required": ["url"],
|
||||
},
|
||||
handler=open_new_window_handler
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,16 @@
|
||||
import asyncio
|
||||
from typing import Any, Dict
|
||||
from tools.utils import ToolError
|
||||
|
||||
async def handle(args: Dict[str, Any], bridge: Any) -> list:
|
||||
"""
|
||||
Opens a new Firefox window with the specified URL.
|
||||
"""
|
||||
url = args.get("url")
|
||||
if not url:
|
||||
raise ToolError("Missing required argument: 'url'")
|
||||
|
||||
request_id = f"req_{asyncio.get_event_loop().time()}_{id(args)}"
|
||||
await bridge.send_to_extension(request_id, "open_new_window", {"url": str(url)})
|
||||
|
||||
return [{"type": "text", "text": f"Opened new window with {url}."}]
|
||||
Reference in new issue
Block a user