Initial commit
This commit is contained in:
commit
52ddc6ba9a
27 files changed
+2166
No files matched your search
@@ -0,0 +1,27 @@
|
||||
import asyncio
|
||||
from typing import Any, Dict
|
||||
from tools.utils import ToolError
|
||||
|
||||
async def handle(args: Dict[str, Any], bridge: Any) -> list:
|
||||
"""
|
||||
Lists all open Firefox tabs.
|
||||
"""
|
||||
request_id = f"req_{asyncio.get_event_loop().time()}_{id(args)}"
|
||||
result = await bridge.send_to_extension(request_id, "list_tabs", {})
|
||||
|
||||
tabs = result if isinstance(result, list) else []
|
||||
|
||||
lines = ["# Open Tabs\n"]
|
||||
if not tabs:
|
||||
lines.append("No tabs found.")
|
||||
else:
|
||||
for tab in tabs:
|
||||
tid = tab.get("id", "?")
|
||||
title = tab.get("title", "(no title)")
|
||||
url = tab.get("url", "")
|
||||
active = " (ACTIVE)" if tab.get("active") else ""
|
||||
wid = tab.get("windowId", "?")
|
||||
lines.append(f"- **Tab {tid}** (window {wid}): {title}{active}")
|
||||
lines.append(f" URL: {url}")
|
||||
|
||||
return [{"type": "text", "text": "\n".join(lines)}]
|
||||
Reference in new issue
Block a user