[docs]classCurrentWebPageToolInput(BaseModel):"""Explicit no-args input for CurrentWebPageTool."""
[docs]classCurrentWebPageTool(BaseBrowserTool):# type: ignore[override, override]"""Tool for getting the URL of the current webpage."""name:str="current_webpage"description:str="Returns the URL of the current page"args_schema:Type[BaseModel]=CurrentWebPageToolInputdef_run(self,run_manager:Optional[CallbackManagerForToolRun]=None,)->str:"""Use the tool."""ifself.sync_browserisNone:raiseValueError(f"Synchronous browser not provided to {self.name}")page=get_current_page(self.sync_browser)returnstr(page.url)asyncdef_arun(self,run_manager:Optional[AsyncCallbackManagerForToolRun]=None,)->str:"""Use the tool."""ifself.async_browserisNone:raiseValueError(f"Asynchronous browser not provided to {self.name}")page=awaitaget_current_page(self.async_browser)returnstr(page.url)