close_browser
Closes the active browser connection to end debugging sessions and release resources in Chrome automation workflows.
Instructions
关闭浏览器连接
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/browserSession.ts:138-150 (handler)Implements the core logic to close or disconnect the browser session and reset internal 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)Defines the tool schema with name, description, and empty input schema for the close_browser tool.{ name: "close_browser", description: "关闭浏览器连接", inputSchema: { type: "object", properties: {}, }, },
- src/index.ts:178-180 (registration)Registers the handler dispatch for close_browser tool calls in the MCP CallToolRequestSchema handler.case "close_browser": result = await this.browserSession.closeBrowser(); break;