browser_close
Closes browser windows automatically to manage system resources and maintain workflow efficiency in Windows automation tasks.
Instructions
关闭浏览器
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "browser_close"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sessionId | No | 会话 ID(可选) |
Implementation Reference
- src/tools/browser.js:252-267 (handler)The handler function that executes the browser_close tool logic: closes the Puppeteer browser for the given sessionId, cleans up storage, and returns status.
async closeBrowser(sessionId = 'default') { try { const browser = this.browsers.get(sessionId); if (!browser) { return { success: false, error: '浏览器未找到' }; } await browser.close(); this.browsers.delete(sessionId); this.pages.delete(sessionId); return { success: true, message: '浏览器已关闭', sessionId }; } catch (error) { return { success: false, error: error.message }; } } - src/tools/browser.js:99-108 (schema)Input schema and metadata definition for the browser_close tool.
{ name: 'browser_close', description: '关闭浏览器', inputSchema: { type: 'object', properties: { sessionId: { type: 'string', description: '会话 ID(可选)' }, }, }, }, - src/tools/browser.js:139-140 (registration)Registration of the browser_close handler in the central executeTool switch dispatcher.
case 'browser_close': return await this.closeBrowser(args.sessionId);