diff --git a/app/tool/browser_use_tool.py b/app/tool/browser_use_tool.py index 981ef1c..d2cf2a5 100644 --- a/app/tool/browser_use_tool.py +++ b/app/tool/browser_use_tool.py @@ -11,6 +11,7 @@ from pydantic_core.core_schema import ValidationInfo from app.tool.base import BaseTool, ToolResult + _BROWSER_DESCRIPTION = """ Interact with a web browser to perform various actions such as navigation, element interaction, content extraction, and tab management. Supported actions include: @@ -173,23 +174,23 @@ class BrowserUseTool(BaseTool): elif action == "screenshot": screenshot = await context.take_screenshot(full_page=True) return ToolResult( - output= - f"Screenshot captured (base64 length: {len(screenshot)})", + output=f"Screenshot captured (base64 length: {len(screenshot)})", system=screenshot, ) elif action == "get_html": html = await context.get_page_html() - truncated = html[:2000] + "..." if len( - html) > 2000 else html + truncated = html[:2000] + "..." if len(html) > 2000 else html return ToolResult(output=truncated) elif action == "get_text": - text = await context.execute_javascript('document.body.innerText') + text = await context.execute_javascript("document.body.innerText") return ToolResult(output=text) elif action == "read_links": - links = await context.execute_javascript("document.querySelectorAll('a[href]').forEach((elem) => {if (elem.innerText) {console.log(elem.innerText, elem.href)}})") + links = await context.execute_javascript( + "document.querySelectorAll('a[href]').forEach((elem) => {if (elem.innerText) {console.log(elem.innerText, elem.href)}})" + ) return ToolResult(output=links) elif action == "execute_js":