browser_reset
Reset the Selenium browser session to a clean state, resolving issues caused by stale sessions or accumulated state during automated tests.
Instructions
Restart the Selenium browser session.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/selenium_mcp_server/browser.py:62-65 (handler)Core logic of browser_reset: calls stop() then start() on BrowserManager to restart the browser session.
def reset(self) -> BrowserState: with self._lock: self.stop() return self.start() - src/selenium_mcp_server/server.py:48-50 (handler)MCP tool handler for browser_reset; delegates to _run(browser.reset).
def browser_reset() -> dict[str, Any]: """Restart the Selenium browser session.""" return _run("browser_reset", browser.reset) - src/selenium_mcp_server/server.py:35-35 (registration)The @mcp.tool() decorator on line 35 registers the browser_reset function as an MCP tool (the decorator on the preceding function applies to browser_start, but all tool functions in this file are registered via @mcp.tool()).
@mcp.tool() - The _run helper that wraps all tool executions, including browser_reset, with error handling.
def _run(action: str, func: Any, *args: Any, **kwargs: Any) -> Any: try: return _as_dict(func(*args, **kwargs)) except BrowserError: logger.exception("Browser action failed: %s", action) raise except Exception as exc: logger.exception("Unexpected Selenium MCP error during %s", action) raise BrowserError(f"{action} failed: {exc}") from exc