close_browser
Shuts down active browser connections managed by the Chrome Debug MCP Server, ensuring clean termination of automation sessions.
Instructions
关闭浏览器连接
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/browserSession.ts:138-150 (handler)The main handler function for closing the browser connection. It disconnects or closes the browser instance if it exists and resets the session state.async closeBrowser(): Promise<BrowserActionResult> { if (this.browser || this.page) { console.log("关闭浏览器连接..."); if (this.isUsingRemoteBrowser && this.browser) { await this.browser.disconnect().catch(() => {}); } else { await this.browser?.close().catch(() => {}); } this.resetBrowserState(); } return { success: true }; }
- src/index.ts:60-67 (schema)The tool schema definition in the list of tools, including name, description, and empty input schema (no parameters required).{ name: "close_browser", description: "关闭浏览器连接", inputSchema: { type: "object", properties: {}, }, },
- src/index.ts:178-180 (registration)Registration in the CallToolRequestSchema handler switch statement that dispatches to the browserSession.closeBrowser() method.case "close_browser": result = await this.browserSession.closeBrowser(); break;
- src/browserSession.ts:155-160 (helper)Helper method called by closeBrowser to reset all browser-related state variables.private resetBrowserState(): void { this.browser = undefined; this.page = undefined; this.currentMousePosition = undefined; this.isUsingRemoteBrowser = false; }